[postgis-users] Slow query ST_SummaryStatsAgg over tiles

matteo rivola mrganesh86 at gmail.com
Wed Aug 10 08:30:47 PDT 2016


Dear all,
I'm using postigis version 2.2.1, on PostgreSQL 9.2.0.

I loaded SRTM DEM geotiff with raster2pgsql.
I create a query in order to retrieve the global statistics of the tiles,
over only Europe zone.

The query is:

SELECT ((stats).min) as value from (SELECT
ST_SummaryStatsAgg(ST_Clip(<DB_table>.rast,ST_GeomFromText(<wkt>,ST_SRID(<DB_table>.rast)),true),1,true)
as stats from <DB_table>) as stats;

where DB_table is the table in which are the rasters and wkt is equal to
'POLYGON((-16 74,39 74,39 33,-16 33,-16 74))'.

The query works fine but it takes a lot of time.

Is there a way to speed up the query?

Cheers,
Matteo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20160810/94c53ca2/attachment.html>


More information about the postgis-users mailing list