[postgis-devel] ST_Envelope & spatial index
Paul Ramsey
pramsey at opengeo.org
Tue Mar 13 14:26:25 PDT 2012
Two things: ST_Extent(geom) will never use an index, on raster or
otherwise, because it has to scan the whole table. Worse, the spatial
indexes on raster are built by default against ST_ConvexHull(raster)
which means in order to access the index your query must itself
include ST_ConvexHull(raster) when referencing the raster parts.
P.
On Tue, Mar 13, 2012 at 2:24 PM, Andrea Peri <aperi2007 at gmail.com> wrote:
> Hi,
>
> The raster function ST_Envelope() will use the GIST Index if existent ?
>
> It seem to be particularly slow.
>
> So I try to do this:
>
> 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)
>
> Also I verify there the GIST Index create from raster2pgsql
>
> CREATE INDEX ofc10k_2010_rast_gist
> ON raster.ofc10k_2010
> USING gist
> (st_convexhull(rast) );
>
> --
> -----------------
> Andrea Peri
> . . . . . . . . .
> qwerty àèìòù
> -----------------
>
>
> _______________________________________________
> 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