Re: [NOVICE] Function which gives back the

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Virgile Beddok <virgile(dot)beddok(at)igd(dot)fraunhofer(dot)de>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, pgsql-novice(at)postgresql(dot)org, pgsql-advocacy(at)postgresql(dot)org
Subject: Re: [NOVICE] Function which gives back the
Date: 2005-04-03 12:14:52
Message-ID: 20050403121452.GA27923@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-advocacy pgsql-novice

On Mon, Mar 28, 2005 at 18:32:09 +0200,
Virgile Beddok <virgile(dot)beddok(at)igd(dot)fraunhofer(dot)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.

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Bruno Wolff III 2005-04-03 13:11:15 Re: ´Stalled post to pgsq
Previous Message Juan Miguel 2005-04-03 10:43:46 Re: postgres 7.2.1 pg_restore large objects

Browse pgsql-advocacy by date

  From Date Subject
Next Message Josh Berkus 2005-04-04 00:12:06 Re: Question
Previous Message Christopher Kings-Lynne 2005-04-03 02:57:56 Re: Question

Browse pgsql-novice by date

  From Date Subject
Next Message Sean Davis 2005-04-03 12:45:27 Re: :(( VEEERRRRYYYY SLLLOOOWWWWWW!
Previous Message Bruce Momjian 2005-04-03 03:05:50 Re: Installation on Windows XP Home not possible