[postgis-users] function speed
Christo Du Preez
christo at mecola.com
Thu May 31 08:47:28 PDT 2007
I wonder if someone can perhaps shed so light on a very strange issue.
I'm not sure if this is a postgis or postgres question.
I've written a function that takes a geometry and a couple of other
arguments then in the function I simply select from a table with 6.5mil
rows using
WHERE the_geom && $1
AND distance($1 ,g.the_geom) < $2
It takes forever, but if I only execute the select statement it's very fast.
WHERE the_geom && geomfromtext('POLYGON((-180.0 -90.0, -180.0 90.0,
180.0 90.0, 180.0 -90.0, -180.0 -90.0))')
AND distance(geomfromtext('POLYGON((-180.0 -90.0, -180.0 90.0, 180.0
90.0, 180.0 -90.0, -180.0 -90.0))'),the_geom) < 201.25
Now the really strange thing is when I hardcode the function it's also fast.
Is there someone that could shed some light on this?
More information about the postgis-users
mailing list