Opened 4 years ago
Last modified 20 months ago
#4987 new enhancement
Reorganize spatial_ref_sys
Reported by: | strk | Owned by: | pramsey |
---|---|---|---|
Priority: | medium | Milestone: | PostGIS Fund Me |
Component: | postgis | Version: | master |
Keywords: | Cc: |
Description ¶
The current strategy of mixing custom and system records in the same spatial_ref_sys table is a bit complex and prone to errors on upgrade, whereas users changing a system record would see those records changed on upgrade.
This ticket is to find a cleaner solution.
My proposal is to turn spatial_ref_sys into a view and provide spatial_ref_sys_postgis containing the official entries and a spatial_ref_sys_user to contain custom/overridden entries.
The view would pick records from spatial_ref_sys_user in preference to those in spatial_ref_sys_postgis.
I've given this solution a try and with a non-materialized view the performance hit is that a _user table with ~100 overrides makes a query for a single SRID 2.5x slower than directly fetching that record from a table (but it's still around 2ms on my laptop).
Test of my implementation is in https://gitlab.com/postgis/postgis/-/merge_requests/57
Change History (6)
comment:1 by , 4 years ago
comment:2 by , 4 years ago
So after trying to implement the view idea I'm really appreciating the simplicity of Regina's solution of just adding an is_custom
boolean column. Such column could determine whether or not the entries are reset on update or not (only non-custom entries should be reset) and whether or not they are dumped by pg_dump I guess (custom entries should be dumped).
During the excercise I've seen that at least gitlab-ci bot is not testing much about spatial_ref_sys because it succeeded way too easily …
comment:3 by , 3 years ago
I've pushed a "spatial-ref-sys-view" branch to the official repository for bots to check (and humans too). Please let me know what you think about it.
comment:4 by , 3 years ago
Milestone: | PostGIS 3.3.0 → PostGIS 3.4.0 |
---|
comment:5 by , 21 months ago
Milestone: | PostGIS 3.4.0 → PostGIS 3.5.0 |
---|
I remain skeptical of the churn/reward ratio of mucking with spatial referencing anymore than is absolutely necessary.
comment:6 by , 20 months ago
Milestone: | PostGIS 3.5.0 → PostGIS Fund Me |
---|
The situation depicted in #4405 could be a good one to test performances (index on ST_Transform)