[postgis-tickets] [PostGIS] #5337: Row estimate for gist geometry index is more than 500 times smaller than actual count

PostGIS trac at osgeo.org
Mon Feb 13 23:12:23 PST 2023


#5337: Row estimate for gist geometry index is more than 500 times smaller than
actual count
-----------------------------+---------------------------
  Reporter:  Björn Harrtell  |      Owner:  pramsey
      Type:  defect          |     Status:  new
  Priority:  medium          |  Milestone:  PostGIS 3.4.0
 Component:  postgis         |    Version:  3.2.x
Resolution:                  |   Keywords:
-----------------------------+---------------------------
Comment (by Björn Harrtell):

 Mabye this is simply me doing things the wrong way. The bad row estimate
 is when using static geometry from a CTE. If I supply the geometry as
 literal I get a good estimate!

 With geometry from joined single row CTE:

 ->  Bitmap Heap Scan on geodkobjekt g  (cost=68.27..5625.92 rows=2819
 width=472)
       Recheck Cond: (geometri &&
 (st_setsrid((st_extent(geodkobjekt.geometri))::geometry, 25832)))
       ->  Bitmap Index Scan on geodkobjekt_geometri_idx  (cost=0.00..67.56
 rows=2819 width=0)
             Index Cond: (geometri &&
 (st_setsrid((st_extent(geodkobjekt.geometri))::geometry, 25832)))

 With literal geometry:

 ->  Parallel Bitmap Heap Scan on geodkobjekt g  (cost=36847.48..1506295.63
 rows=648121 width=0)
       Recheck Cond: (geometri &&
 '0103000020E8640000010000000500000000000000D3E0254166666686C687574100000000D3E0254185EB51D8B998574114AE476120A2264185EB51D8B998574114AE476120A2264166666686C687574100000000D3E0254166666686C6875741'::geometry)
       ->  Bitmap Index Scan on geodkobjekt_geometri_idx
 (cost=0.00..36458.60 rows=1555491 width=0)
             Index Cond: (geometri &&
 '0103000020E8640000010000000500000000000000D3E0254166666686C687574100000000D3E0254185EB51D8B998574114AE476120A2264185EB51D8B998574114AE476120A2264166666686C687574100000000D3E0254166666686C6875741'::geometry)
-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/5337#comment:4>
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