Re: Get closest numbers between intervals

Поиск
Список
Период
Сортировка
От Dimitri Fontaine
Тема Re: Get closest numbers between intervals
Дата
Msg-id m2vdk2uyea.fsf@hi-media.com
обсуждение исходный текст
Ответ на Get closest numbers between intervals  (xaviergxf <xaviergxf@gmail.com>)
Список pgsql-general
xaviergxf <xaviergxf@gmail.com> writes:
> city_code, start_ip, end_ip
>
> I´m searching for the city that its between two ip´s. But, i would
> like to get the nearest´s cities too.

I'd have a look at ip4r rather than having both the start and end ip
there. The GiST index on ip4r allow for quick lookup:

  SELECT * FROM ... WHERE iprange >>= '1.2.3.4'::ip4;

  http://pgfoundry.org/projects/ip4r/

> Any ideas how can i search for the city proximity?

I'd have a look at earthdistance contrib, then maybe PostGIS:

  http://www.postgresql.org/docs/8.4/static/earthdistance.html

Regards,
--
dim

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

Предыдущее
От: Himanshu Gupta
Дата:
Сообщение: how to use multiple schema's
Следующее
От: Lennin Caro
Дата:
Сообщение: Re: No buffer space available