Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#4676 closed enhancement (fixed)

Use PG_GETARG_GSERIALIZED_P_SLICE to access geometry headers

Reported by: Algunenano Owned by: pramsey
Priority: medium Milestone: PostGIS 3.1.0
Component: postgis Version: master
Keywords: Cc:

Description

After the multiple improvements in PG12 in the partial decompression of toasted objects (thanks Paul), using PG_GETARG_GSERIALIZED_P_SLICE for toasted geometries can lead to big performance improvements in the functions that only need the geometry header.

A quick example using ST_SRID over huge geometries:

explain analyze Select ST_SRID(the_geom) from benchmark_4c7214d90a79aa6760367a084a4d4a2f61fbe1c6cc4f7f9e76020;
-- Before latency average = 16.983 ms
-- After latency average = 0.145 ms
-- Perf: 117 x

Change History (3)

comment:1 by Algunenano, 5 years ago

Another example that shows how much of an impact can this make with big datasets:

explain analyze Select a.the_geom && b.the_geom from benchmark_4c7214d90a79aa6760367a084a4d4a2f61fbe1c6cc4f7f9e76020 a, benchmark_4c7214d90a79aa6760367a084a4d4a2f61fbe1c6cc4f7f9e76020 b;
-- Before latency average = 423.047 ms
-- After latency average = 0.886 ms
-- Perf: 477.47x

comment:2 by Raúl Marín <git@…>, 5 years ago

Resolution: fixed
Status: newclosed

In 83c62db/git:

Avoid decompressing toasted geometries to read only the header

Closes #4676
Closes https://github.com/postgis/postgis/pull/558

comment:3 by Raúl Marín <git@…>, 5 years ago

In 39adc44/git:

Optimize geometry_to_point

References #4676

Note: See TracTickets for help on using tickets.