[postgis-devel] [PostGIS] #1828: Estimate returned by geography_gist_selectivity results in slow query plan for ST_DWithin

PostGIS trac at osgeo.org
Tue Jul 3 09:52:04 PDT 2012


#1828: Estimate returned by geography_gist_selectivity results in slow query plan
for ST_DWithin
---------------------------+------------------------------------------------
 Reporter:  realityexists  |       Owner:  mcayland     
     Type:  defect         |      Status:  new          
 Priority:  medium         |   Milestone:  PostGIS 2.0.2
Component:  postgis        |     Version:  2.0.x        
 Keywords:                 |  
---------------------------+------------------------------------------------

Comment(by mcayland):

 Right - the reason there are 2 calls to the function are because there are
 2 && operators in the rewritten query. The first is <col> && <const>
 (which we can at least attempt an estimate) and the second is <const> &&
 expand(<col>) which we can't do much about because the function is
 effectively a black box to the planner, hence we bail out returning the
 default estimate.

 I'm thinking that the reason we are underestimating is because in 3
 dimensions we intersect a larger number of potential histogram boxes
 within 3D space, but they are mostly empty due to the curvature of the
 spheroid which drags avg_feat_cells unusually low. This will need some
 testing to verify this though. Therefore for geography I think we either
 need to determine how to alter the mathematics to handle this, or possibly
 even consider converting the inputs to 2D and using something similar to
 the existing geometry code.

-- 
Ticket URL: <http://trac.osgeo.org/postgis/ticket/1828#comment:35>
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-devel mailing list