[postgis-devel] ST_Envelope & spatial index

dustymugs dustymugs at gmail.com
Tue Mar 13 14:50:41 PDT 2012


ST_Extent is an aggregate function so without any WHERE clauses, it has 
to scan the entire table.  This would be true regardless of datatype 
(raster, geometry, geography).

-bborie

On 03/13/2012 02:47 PM, Andrea Peri wrote:
>>> * explain select ST_Extent(ST_Envelope(rast)) from raster.ofc10k_2010 limit 1;*>>* *>>* And see that.*>>* *>>* Limit  (cost=48027.93..48027.94 rows=1 width=32)*>>*   ->   Aggregate  (cost=48027.93..48027.94 rows=1 width=32)*>>*         ->   Seq Scan on ofc10k_2010  (cost=0.00..37419.53 rows=1414453*>>* width=32)*>>*
>
> *>Try this:
>>
>> SELECT ST_Extent(rast::geometry) from raster.ofc10k_2010;
>>
>> Pierre
>
> Hi, Pierre,
> I test you query (with limit 1 to have same conditions).
>
> SELECT ST_Extent(rast::geometry) from raster.ofc10k_2010 limit 1;
>
>
> It report this cost:
> It is rather the same.
>
> Limit  (cost=44491.80..44491.81 rows=1 width=32)
>    ->   Aggregate  (cost=44491.80..44491.81 rows=1 width=32)
>          ->   Seq Scan on ofc10k_2010  (cost=0.00..37419.53 rows=1414453
> width=32)
>
>
>
>
>
> _______________________________________________
> postgis-devel mailing list
> postgis-devel at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-devel



More information about the postgis-devel mailing list