[postgis-tickets] [PostGIS] #3739: ST_Within Not using index

PostGIS trac at osgeo.org
Fri Apr 28 12:13:17 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):

 Yah that is the thing that puzzles me the extra ~ making it do the right
 thing.
 If it did the same with just ~ I would have dismissed it as just a a stats
 issue with the fact that stats are only single columned and to do this
 justice you'd need compound on admin_level , geometry.  Multicolumn stats.
 are coming in PostgreSQL 10.

 I also thought there was a time when it collapsed redundant statements ~
 AND ~, but perhaps they took that logic out.

 Do you see a difference in costs between when you do something like


 {{{
 set enable_seqscan = false;

 -- apply the original


 }}}

 Does it do the right thing or still try to do sequential scan?

 pramsey , strk any thoughts on why doing ST_Within() .. vs.  ~ AND
 ST_Within().. would make a difference.

 I'm suspecting it's not even considering the solution with
 the index because it has to peak into the function to expose the ~ and
 that itself has a cost, so if it's already drummed up enough plans to try
 it may stop after x number.

 That's a very wild uneducated guess.

--
Ticket URL: <https://trac.osgeo.org/postgis/ticket/3739#comment:22>
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