O'Reilly logo

PostGIS Essentials by Angel Marquez

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Tuning spatial queries

To illustrate how much an index helps to accelerate our spatial query, let's return to our spatial database, Real-World. We have already loaded data from several cities in Great Britain, and at this time we have more than half a million registers saved in our data table. This set of stored records will be good enough for this exercise.

Now, let's develop the spatial query to perform the test. Let's say that we want a query that gives us a list of all the buildings that were one-fourth of a mile from an arbitrary building. To illustrate this, we have chosen the Royal College of Music as a reference point without any particular reason. This image will depict this point graphically:

Our spatial query will, therefore, be:

SELECT ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required