[postgis-users] st_within too slow? -- room for development improvement?

Pedro Doria Meunier pdoria at netmadeira.com
Tue Sep 2 05:29:21 PDT 2008


Dear Regina,

Thanks for your suggestion :)
The thing is that using st_intersects doesn't help. :-(
The performance is exactly the same which actually puzzles me for
functions (namely ST_Within) that should return almost instantly ...
Problem being that as far as I can see there's no other function that
replaces these for the same effect...

(Call to developers)
This leads me to asking: isn't there room for improvement in these
functions?

The above functions are suitable for very small scale implementations
(like for fleets < 50 vehicles) but when it comes to real-world
implementations with fleets >200 vehicles using these functions almost
grinds the location implementation to a screeching halt...

All the best,
Pedro.


On Sat, 2008-08-30 at 08:59 -0400, Obe, Regina wrote:
> Pedro,
> 
> Try using st_intersects instead of ST_within.  In general I think it
> performs better than within and for point in poly will be just as
> good.
> 
> Yah Guido's suggestion would be at best give same timing since
> ST_Within, ST_Intersects have an implicit && call in them so they can
> limit the number of more painful _ST_Within, _ST_Intersects checks
> they actually need to do.
> 
> Hope that helps,
> Regina
> 
> 
> 
> -----Original Message-----
> From: postgis-users-bounces at postgis.refractions.net on behalf of Pedro
> Doria Meunier
> Sent: Sat 8/30/2008 8:16 AM
> To: PostGIS Users Discussion
> Subject: RE: [postgis-users] st_within too slow?
> 
> Dear Guido,
> 
> Thanks for replying.
> Your suggested mod actually worsens the performance by another
> ~15-20ms
> 
> Best regards,
> --
> Pedro Doria Meunier <pdoria at netmadeira.com>
> 
> > Pedro,
> >
> > Try this instead:
> >
> > SELECT road_network, toponymy FROM maps AS m WHERE m.b_box &&
> > geomfromtext('POINT($lon $lat)',4326) and
> > st_within(geomfromtext('POINT($lon $lat)',4326), m.b_box)
> >
> > of course, if you already know that the point is in Portugal,
> > you could do:
> >
> > SELECT road_network, toponymy FROM maps AS m WHERE
> > m.country = 'PT' and
> > m.b_box && geomfromtext('POINT($lon $lat)',4326)
> >
> > (assuming that the maps table has the 'country' column with
> > country names).
> >
> > GL
> 
> 
> 
> 
> 
> ______________________________________________________________________
> 
> The substance of this message, including any attachments, may be
> confidential, legally privileged and/or exempt from disclosure
> pursuant to Massachusetts law. It is intended solely for the
> addressee. If you received this in error, please contact the sender
> and delete the material from any computer.
> 
> 
> ______________________________________________________________________
> 
> Help make the earth a greener place. If at all possible resist
> printing this email and join us in saving paper. 
> 
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20080902/e2c39bb5/attachment.pgp>


More information about the postgis-users mailing list