Index on points

Started by Holger Klawitteralmost 22 years ago3 messagesgeneral
Jump to latest
#1Holger Klawitter
lists@klawitter.de

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi there,

which operator class can I use in order to search points by distance like in:

SELECT p FROM tbl WHERE (p <-> point(0,0)) < 10;

- From what I've seen, there is none - which surprises me ...

Mit freundlichem Gruß / With kind regards
Holger Klawitter
- --
lists <at> klawitter <dot> de
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQFAxa561Xdt0HKSwgYRAriFAJ4jiNya++OcM8LuQbl/nhhjiKcQywCfeeUj
FuMLsNgpOR0totwbDfp68SM=
=R1om
-----END PGP SIGNATURE-----

#2Bruno Wolff III
bruno@wolff.to
In reply to: Holger Klawitter (#1)
Re: Index on points

On Tue, Jun 08, 2004 at 14:17:57 +0200,
Holger Klawitter <lists@klawitter.de> wrote:

Hi there,

which operator class can I use in order to search points by distance like in:

SELECT p FROM tbl WHERE (p <-> point(0,0)) < 10;

- From what I've seen, there is none - which surprises me ...

You want to create a box that includes all points that might match
and use that to do an index search (using an rtree index) and then
check that the distance is really less than whatever.

#3Holger Klawitter
lists@klawitter.de
In reply to: Bruno Wolff III (#2)
Re: Index on points

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi!

SELECT p FROM tbl WHERE (p <-> point(0,0)) < 10;

You want to create a box that includes all points that might match
and use that to do an index search (using an rtree index) and then
check that the distance is really less than whatever.

Thanks for the hint!
I was just too confused about the lack of point operators to think about
alternatives...

Mit freundlichem Gruß / With kind regards
Holger Klawitter
- --
lists <at> klawitter <dot> de
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQFAxc2h1Xdt0HKSwgYRAl47AJ0XF49Mr8OgPSwM5uULTOcp3nGVAgCfWWp9
NBrsrP1Fnu2+UCo63niQzjQ=
=/7qF
-----END PGP SIGNATURE-----