[postgis-devel] [PostGIS] #1248: Increasing cost of spatial functions.

PostGIS trac at osgeo.org
Wed Oct 19 03:56:35 PDT 2011

#1248: Increasing cost of spatial functions.
 Reporter:  SzymonG  |       Owner:  pramsey      
     Type:  defect   |      Status:  new          
 Priority:  medium   |   Milestone:  PostGIS 2.0.0
Component:  postgis  |     Version:  1.5.X        
 Keywords:           |  

Comment(by SzymonG):

 The cost of 100 was way too low to have the faster plan. I've changed that
 to 1000 and then the plan was much faster.

 A couple of days ago in a program that uses the instersects function
 (cost=1) similar problem occured. Changing the cost from 1 to 1000 made
 the application much faster (from 7 hours of computation to 4). The query
 speed changed from 250ms to even 10ms. And yes, I know that using the
 intersects function is not the best idea, but with st_intersects the
 problem occurs as well.

 I've also checked the cost change in a database full of small geometries,
 there was no regression in application speed.

 The error occurs with Postgres 8.4 and 9.0, on Windows and Linux (Ubuntu
 64bit - 11.04 && 11.10).

 I know that it could be risky and I don't know if upping the cost even
 more is good, that's why I wrote that is should be considered. However I
 had to add the cost upping queries into scripts used for loading data into
 new databases to make them much faster.

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