#4672 closed enhancement (fixed)
Cache the return value for getSRSbySRID and getSRIDbySRS per transaction
Reported by: | Algunenano | Owned by: | pramsey |
---|---|---|---|
Priority: | medium | Milestone: | PostGIS 3.1.0 |
Component: | postgis | Version: | master |
Keywords: | Cc: |
Description
Currently the performance of any function that uses getSRSbySRID is defined by the time it takes to get the SRS. Since this won't change during the execution of the function, we should be able to cache the return value and avoid calling it over and over when all the geometries in the relation have the same SRID (which I guess is the most common case).
This affects:
- ST_AsGML for geometry and geography.
- ST_AsGeoJSON: geography (always) and geometry (only a crs option is set).
- ST_AsX3D
Change History (4)
comment:1 by , 5 years ago
comment:2 by , 5 years ago
Summary: | Cache the return value for getSRSbySRID per transaction → Cache the return value for getSRSbySRID and getSRIDbySRS per transaction |
---|
I decided to also cache getSRIDbySRS, which gives a 40x improvement to ST_GeomFromGeoJSON.
Note:
See TracTickets
for help on using tickets.
PR: https://github.com/postgis/postgis/pull/557
I've removed the srs calculation from ST_AsX3D since it was never used.
For a point dataset (same srs for all rows) this greatly improves the performance: