Re: Indexing a field of type point

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Indexing a field of type point
Дата
Msg-id 17550.1186680807@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Indexing a field of type point  (David Cottingham <david.cottingham@cl.cam.ac.uk>)
Список pgsql-sql
David Cottingham <david.cottingham@cl.cam.ac.uk> writes:
> I have a table containing a field named location, of type point, i.e. a 
> position in two dimensions. The table has several million records in, and I 
> need to extract those records whose location value is contained within a 
> certain bounding box.

Given the standard opclasses, your best bet is to convert the point into
a zero-volume box or circle, eg
create index i on t using gist (circle(pointcol,0))

and then express queries as "circle(pointcol,0) overlaps target-box".

PostGIS might have something more nicely adapted ...
        regards, tom lane


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

Предыдущее
От: David Cottingham
Дата:
Сообщение: Indexing a field of type point
Следующее
От: Andreas Joseph Krogh
Дата:
Сообщение: PG won't use index on ORDER BY