Re: nearest neighbor search from xyz coordinates

From: "Serge Fonville" <serge(dot)fonville(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>, "Andreas Jochem" <andruit(at)gmx(dot)de>
Subject: Re: nearest neighbor search from xyz coordinates
Date: 2008-10-27 11:26:51
Message-ID: 680cbe0e0810270426t567cfc2bia38e0d570f6b91f3@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

What exactly do you want to measure, since values can be compared easily by
a where clauseIf you would want for example all rows within a spherical
distance
you will either have to write a stored procedure (which takes 4 parameters
x,y,z,distance)
Or manually compare each corodinate to the distance

Regards,

Serge Fonville

On Mon, Oct 27, 2008 at 11:50 AM, Andreas Jochem <andruit(at)gmx(dot)de> wrote:

> Hello,
>
> I have a table containing x y z coordinates. But I have no geometry column?
> Is it possible to find the k nearest neighbors of any point. Is there
> something like a kd-tree Index in postgres???
>
> I know, if i had a geometry column I could make use of the distance
> function to find the k nearest neighbors. But my table has millions of
> records, thus it would take a very long time to use the distance function
> for each point.
>
> Thanks in advance.
>
> Andi
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2008-10-27 12:12:32 Re: [PLPGSQL] PERFORM into an EXECUTE allowed ?
Previous Message Abdul Rahman 2008-10-27 11:17:38 Replication with slony-I