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

PostGIS trac at osgeo.org
Fri Jun 22 10:08:02 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 pramsey):

 The patch does fix things, in that the query box now has a non-zero
 extent... however the estimate is still way off.
 {{{
 postgis20=# explain analyze SELECT id FROM _test_pos WHERE ST_DWithin(pos,
 'POINT(7 7)'::geography, 300000);
 NOTICE:   requested search box is : 0.938059508800507 0.0738726407289505
 0.0747810378670692, 1.03223621845245 0.168049246072769 0.168957650661469
 QUERY PLAN
 -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  Seq Scan on _test_pos  (cost=0.00..5578.00 rows=1 width=4) (actual
 time=17.239..67.544 rows=3839 loops=1)
    Filter: ((pos &&
 '0101000020E61000000000000000001C400000000000001C40'::geography) AND
 ('0101000020E61000000000000000001C400000000000001C40'::geography &&
 _st_expand(pos, 300000::double precision)) AND _st_dwithin(pos,
 '0101000020E61000000000000000001C400000000000001C40'::geography,
 300000::double precision, true))
 }}}

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