Re: [NOVICE] Function which gives back the nearest neighbours

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 nearest neighbours
Date: 2005-03-28 17:22:23
Message-ID: 20050328172223.GA11567@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.

How are you measuring distance? (i.e. Euclidean distance isn't the only
metric that you could be using.)

Earthdistance has functions for doing this using geodesics on the surface
of a sphere.

For 2D, I think there is a function on "point"s that uses Euclidean
distance.

I don't think this is the hard part of your problem. It is easy to create
a metric function and get the point corresponding to the minimal value
using a sort. Being able to limit the sets of points looked at is the
hard part.

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Joe Conway 2005-03-28 17:23:15 Re: [NOVICE] Function which gives back the nearest
Previous Message Frank L. Parks 2005-03-28 16:44:43 Re: is postgresql 8 is realy mature

Browse pgsql-advocacy by date

  From Date Subject
Next Message Joe Conway 2005-03-28 17:23:15 Re: [NOVICE] Function which gives back the nearest
Previous Message Virgile Beddok 2005-03-28 16:32:09 Re: [NOVICE] Function which gives back the

Browse pgsql-novice by date

  From Date Subject
Next Message Joe Conway 2005-03-28 17:23:15 Re: [NOVICE] Function which gives back the nearest
Previous Message Virgile Beddok 2005-03-28 16:32:09 Re: [NOVICE] Function which gives back the