[postgis-users] query optimization
Frances Collier
fcollier at preparedresponse.com
Wed May 3 14:20:48 PDT 2006
Hello,
I am trying to figure out a query that will return all the counties that lie
within a specific buffer. The following query accomplishes that, but it
takes 537453ms. We will want to put this result into a web application so we
want to minimize the amount of time it takes. I would really appreciate any
help in optimizing this query.
Query: select
area(intersection(wkb_geometry,
getItemBuffer(-122.330863952637, 47.2580032348633, 0.5))) as areaOfBuffer,
state, county, area
from tblcountypop
where
intersects(wkb_geometry, boundary(
getItemBuffer(-122.330863952637, 47.2580032348633, 0.5)));
getItemBuffer (function): select buffer(simplify(wkb_geometry,0.01),$3) as
wkb_geometry
from tblcountypop
where within(MakePoint($1,$2),wkb_geometry);
The tblcountypop was created from a shapefile and has (estimated) 6138 rows.
I have indexed this table using gist. I have also vacuum analyzed it. I am
using PostgreSQL 8.1 with the default PostGIS which I believe is version
1.0.4 but I haven't figured out how to find the version.
Thank you very much,
Frances Collier
More information about the postgis-users
mailing list