Hello, I've had a quick look at your code, and saw you used the distance() and intersects() functions. You should improve a lot such requests by using indexes more efficiently: See http://postgis.refractions.net/docs/x541.html#AEN545 for details. Furthermore, you should try some "explain analyze" requests ... Best regards Daniel FAIVRE camptocamp.com