I am looking to speed up a postgis query, regarding zonal statistics. I am using postgis 3.0 with postgreSQL 12 and I was hoping that I could apply the below script to speed up processing using multiple CPUs;
// Parallel processing has no effect SET max_parallel_workers = 8; SET max_parallel_workers_per_gather = 4; // Zonal statistics DROP TABLE IF EXISTS schema.zonal_stats; CREATE TABLE schema.zonal_stats AS SELECT id,geom, (ST_SummaryStats(ST_Union(ST_Clip(raster,geom)))).sum FROM schema.raster, schema.ply GROUP BY id,geom;
I could use the
multiprocessing packages in
Python, which does provide a computation speedup. However, I would like to apply parallel processing natively in postgis, as my data is stored in a postgreSQL db.