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

PostGIS trac at osgeo.org
Thu May 17 06:28:43 PDT 2012


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

Comment(by realityexists):

 No, I tried that, but it's fast then. This is the simplest repro I've been
 able to come up with (and even that took about 5 hours!)

 Eg. this query
 {{{
 select id
 from _test_pos
 where __test_points_are_near('POINT(7 7)', pos);
 }}}

 takes 80 ms and the plan is
 {{{

 Seq Scan on _test_pos  (cost=0.00..10728.00 rows=1 width=4) (actual
 time=13.492..56.078 rows=5118 loops=1)
   Filter:
 ((('0101000020E61000000000000000001C400000000000001C40'::geography &&
 _st_expand(pos, 300000::double precision)) AND (pos &&
 '0101000020E61000000000000000001C400000000000001C40'::geography) AND
 _st_dwithin('0101000020E61000000000000000001C400000000000001C40'::geography,
 pos, 300000::double precision, true)) OR
 (('0101000020E61000000000000000001C400000000000001C40'::geography &&
 _st_expand(pos, 400000::double precision)) AND (pos &&
 '0101000020E61000000000000000001C400000000000001C40'::geography) AND
 _st_dwithin('0101000020E61000000000000000001C400000000000001C40'::geography,
 pos, 400000::double precision, true)))
 Total runtime: 61.388 ms
 }}}

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