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.