[postgis-tickets] [PostGIS] #5120: ST_EstimatedExtent returns stats based extent even if index is present
PostGIS
trac at osgeo.org
Tue Mar 29 10:02:46 PDT 2022
#5120: ST_EstimatedExtent returns stats based extent even if index is present
---------------------+---------------------------
Reporter: strk | Owner: pramsey
Type: defect | Status: new
Priority: medium | Milestone: PostGIS 3.3.0
Component: postgis | Version: master
Keywords: |
---------------------+---------------------------
When a GiST index is present on a geometry column it makes no sense for
ST_EstimatedExtent to fallback to stats-based view, if the index based
bbox is returned as null, because that means the table is empty.
To reproduce the problem:
1. Create a spatial table, with an index
2. Add some rows, ANALYZE (creates stats)
3. Truncate the table
4. Run ST_EstimatedExtent for the spatial column
Note there's NO WAY to clear the stats on a truncated table, to my
knowledge. The only way to "refresh" the stats would be to re-add some
rows to it. Instead, in the scenario above, users are left to an
ST_EstimatedExtent return which is plain bogus, when all the information
would be available to the function to return an informed NULL (no rows in
the table, according to index).
See also #5032 for a possibly misinformed value from index query too.
I've tested this in 3.3.0dev (master branch) but it's very likely an old
issue.
--
Ticket URL: <https://trac.osgeo.org/postgis/ticket/5120>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.
More information about the postgis-tickets
mailing list