[PostGIS] #5984: PostGIS selectivity is screwing up queries and forcing it to choose a spatial index when it's inappropriate

PostGIS trac at osgeo.org
Sat Sep 13 07:23:37 PDT 2025


#5984: PostGIS selectivity is screwing up queries and forcing it to choose a
spatial index when it's inappropriate
-----------------------+---------------------------
  Reporter:  robe      |      Owner:  pramsey
      Type:  defect    |     Status:  new
  Priority:  critical  |  Milestone:  PostGIS 3.4.5
 Component:  postgis   |    Version:  3.5.x
Resolution:            |   Keywords:
-----------------------+---------------------------
Comment (by Bas Couwenberg):

 Replying to [comment:7 robe]:
 > and the explain plan for both ST_Contains and ST_Intersects are decent,
 don't use the spatial index

 Not sure why you're using ST_Intersects. ST_Contains is used to remove
 results of nodes outside the bounding box as I'm only interested in
 connected ways within the province/municipality/settlement being
 processed. Ways outside the bounding box find their way into the dataset
 because a part of their ways are within the bounding box and all nodes in
 those ways are downloaded to prevent incomplete ways.
-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/5984#comment:9>
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