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

PostGIS trac at osgeo.org
Tue Jun 6 01:27:48 PDT 2017


#3739: ST_Within Not using index
--------------------------+---------------------------
  Reporter:  postgispaul  |      Owner:  pramsey
      Type:  defect       |     Status:  closed
  Priority:  medium       |  Milestone:  PostGIS 2.3.3
 Component:  postgis      |    Version:  2.3.x
Resolution:  wontfix      |   Keywords:
--------------------------+---------------------------

Comment (by komzpa):

 It's a hardcoded limit:

 https://github.com/postgis/postgis/blob/6c9f8058eb0277ae0ddad323506f5c9377167e9f/postgis/gserialized_estimate.c#L1445

 Increasing statistics will get more data inside cells, but will not
 increase number of cells.

 For 2D world, it is sqrt(40 000 000. * 40 000 000 / (2 * 10 000)) ~= 282
 842 m box.

 It's the total number of cells - it's being rooted here:
 https://github.com/postgis/postgis/blob/6c9f8058eb0277ae0ddad323506f5c9377167e9f/postgis/gserialized_estimate.c#L1554

 By default the STATISTICS is 100, thus world is split into 10x10 grid, 2
 828 km box each. That covers almost all of Europe. If you multiply number
 of nodes in such box by number of countries in such box, you get insanely
 big number.

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