Re: Function which gives back the - Mailing list pgsql-novice

From Bruno Wolff III
Subject Re: Function which gives back the
Date
Msg-id 20050403121452.GA27923@wolff.to
Whole thread Raw
In response to Re: [pgsql-advocacy] Function which gives back the  ("Virgile Beddok" <virgile.beddok@igd.fraunhofer.de>)
List pgsql-novice
On Mon, Mar 28, 2005 at 18:32:09 +0200,
  Virgile Beddok <virgile.beddok@igd.fraunhofer.de> wrote:
>
> I just want to know if there is an existing and implemented function, or
> tree, in Postgres which allows me to directly perform a "nearest neighbour
> search" on multidimensional vectors.

What precisely do you mean by "nearest"? To answer that question you
need a metric function. A common metric function is euclidean distance.
Another common one is distance along the geodesic connecting two points
on the surface of the sphere.

The cube contrib package has indexing that might be useful for doing lossy
matches if you have some upperbound on how far a part a nearest neighbor
can be in your problem. It even will handle multiple dimensions. (You
haven't even bothered to tell us how many dimensions your points have.)

The earthdistance contrib package has a function for calculating distance
on the surface of sphere and uses the cube package to provide a lossy
way of doing indexed searches.

If you want specific anwsers it would help if you would provide us with
more details about the problem you are trying to solve.

pgsql-novice by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Installation on Windows XP Home not possible
Next
From: "Sean Davis"
Date:
Subject: Re: :(( VEEERRRRYYYY SLLLOOOWWWWWW!