[postgis-tickets] [PostGIS] #3739: ST_Within Not using index
PostGIS
trac at osgeo.org
Mon May 1 01:04:03 PDT 2017
#3739: ST_Within Not using index
--------------------------+---------------------------
Reporter: postgispaul | Owner: pramsey
Type: defect | Status: new
Priority: medium | Milestone: PostGIS 2.3.3
Component: postgis | Version: 2.3.x
Resolution: | Keywords:
--------------------------+---------------------------
Comment (by robe):
ahah so I think I was wrong, it is aware of the option to use the index,
but has wrongly concluded it is worse to do so than to use it because it
estimated a traversal count of 265635 rows when there is only 103258 rows.
Why extra ~ puts it over the edge is a bit of a mystery. I suspect it's
just treating it as an extra condition and so multiplying the rows it has
to traverse for the cost, which sways it back in the other direction. So
it's just dumb luck.
One more test,
Can you move the ~ inside the ST_Within
so ~ and ~. I'm suspecting it will have the same affect as it being
outside, but just want to confirm that.
Aside from Paul's (pramsey) note about improving ~ selectivity, perhaps
managing this ourselves, I'm not sure there is much we can do about this.
Even with that, I'm not sure how that would help, as it seems to be very
data specific.
--
Ticket URL: <https://trac.osgeo.org/postgis/ticket/3739#comment:26>
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