Re: Distance calculation

Поиск
Список
Период
Сортировка
От Michael Fuhr
Тема Re: Distance calculation
Дата
Msg-id 20060117180913.GA11539@winnie.fuhr.org
обсуждение исходный текст
Ответ на Distance calculation  (<sunithab@travelpost.com>)
Список pgsql-general
On Tue, Jan 17, 2006 at 10:00:22AM -0800, sunithab@travelpost.com wrote:
> I have a latiude and longitude for a city and latitude, longitude foreach
> hotel in hotels table.
>
> I have to  reitreive 20 hotels nearby to that city in 25 miles. The below
> is the query I am using to check the distance. But the query is slow
> because of distance calulation on fly and order by distance.

You appear to be using PostGIS but the query you posted doesn't use
any of PostGIS's indexable operators.  Have you read the "Using
PostGIS" documentation, in particular the parts that discuss creating
and using indexes on geometry columns?

http://postgis.refractions.net/docs/ch04.html

Your data looks like it has separate lat/lon columns when it should
have a geometry column with a GiST index.

If you're using PostGIS then you might want to subscribe to the
postgis-users mailing list:

http://postgis.refractions.net/mailman/listinfo/postgis-users

--
Michael Fuhr

В списке pgsql-general по дате отправления:

Предыдущее
От: John Sidney-Woollett
Дата:
Сообщение: Re: Distance calculation
Следующее
От: "Andrus"
Дата:
Сообщение: Change owner of all database objects