From the ST_SummaryStatsAgg () doc: "By default will sample all pixels. To get faster response, set sample_percent to value between 0 and 1"
> -----Original Message-----
> From: postgis-users [mailto:[hidden email]] On Behalf
> Of matteo rivola
> Sent: Wednesday, August 10, 2016 11:31 AM
> To: [hidden email] > Subject: [postgis-users] Slow query ST_SummaryStatsAgg over tiles
> 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
> D(<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?