Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --sql
- CREATE TABLE geoms (geom geometry);
- -- Create 20x20 square polygons
- WITH coords AS (SELECT * FROM generate_series(0, 19) AS x, generate_series(0, 19) AS y)
- INSERT INTO geoms
- SELECT ST_Square(1.0, x, y, ST_MakePoint(0, 0))
- FROM coords;
- SET force_parallel_mode=ON;
- SET parallel_setup_cost = 0;
- SET parallel_tuple_cost = 0;
- SET min_parallel_table_scan_size = 0;
- SET max_parallel_workers_per_gather = 6;
- explain analyze WITH u AS (SELECT ST_Union(geom) AS g FROM geoms)
- SELECT ST_Area(g), ST_XMin((g)), ST_YMin(g), ST_XMax(g), ST_YMax(g) FROM u;
- -- version info
- POSTGIS="3.2.0 c3e3cc0" [EXTENSION] PGSQL="130" GEOS="3.9.0-CAPI-1.16.2" PROJ="7.2.1" LIBXML="2.9.10" LIBJSON="0.15" LIBPROTOBUF="1.3.3" WAGYU="0.5.0 (Internal)" TOPOLOGY
- POSTGIS="3.3.4 3.3.4" [EXTENSION] PGSQL="130" GEOS="3.9.0-CAPI-1.16.2" PROJ="7.2.1" LIBXML="2.9.10" LIBJSON="0.15" LIBPROTOBUF="1.3.3" WAGYU="0.5.0 (Internal)" TOPOLOGY
- -- explain output
- postgis 3.2
- QUERY PLAN |
- ------------------------------------------------------------------------------------------------------------------------------+
- Subquery Scan ON u (cost=84.67..85.32 rows=1 width=40) (actual TIME=18.433..18.465 rows=1 loops=1) |
- -> Aggregate (cost=84.67..84.68 rows=1 width=32) (actual TIME=18.429..18.460 rows=1 loops=1) |
- -> Gather (cost=0.00..9.67 rows=400 width=120) (actual TIME=0.150..8.434 rows=400 loops=1) |
- Workers Planned: 2 |
- Workers Launched: 2 |
- -> Parallel Seq Scan ON geoms (cost=0.00..9.67 rows=167 width=120) (actual TIME=0.002..0.019 rows=133 loops=3)|
- Planning TIME: 0.036 ms |
- Execution TIME: 18.524 ms |
- postgis3.3
- QUERY PLAN |
- ------------------------------------------------------------------------------------------------------------------------------------+
- Subquery Scan ON u (cost=35.11..35.76 rows=1 width=40) (actual TIME=18.839..18.870 rows=1 loops=1) |
- -> Finalize Aggregate (cost=35.11..35.12 rows=1 width=32) (actual TIME=18.835..18.866 rows=1 loops=1) |
- -> Gather (cost=10.09..10.10 rows=2 width=32) (actual TIME=0.294..8.671 rows=3 loops=1) |
- Workers Planned: 2 |
- Workers Launched: 2 |
- -> Partial Aggregate (cost=10.09..10.10 rows=1 width=32) (actual TIME=0.048..0.049 rows=1 loops=3) |
- -> Parallel Seq Scan ON geoms (cost=0.00..9.67 rows=167 width=120) (actual TIME=0.007..0.017 rows=133 loops=3)|
- Planning TIME: 0.041 ms |
- Execution TIME: 18.927 ms |
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement