Re: k-neighbourhood search in databases

Lists: pgsql-hackers
From: Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>
To: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: k-neighbourhood search in databases
Date: 2011-04-08 12:21:50
Message-ID: Pine.LNX.4.64.1104081619310.9772@sn.sai.msu.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi there,

I'm interesting if other databases provides built-in effective
knn search ? Google didn't help me.

Regards,
Oleg
_____________________________________________________________
Oleg Bartunov, Research Scientist, Head of AstroNet (www.astronet.ru),
Sternberg Astronomical Institute, Moscow University, Russia
Internet: oleg(at)sai(dot)msu(dot)su, http://www.sai.msu.su/~megera/
phone: +007(495)939-16-83, +007(495)939-23-83


From: PostgreSQL - Hans-Jürgen Schönig <postgres(at)cybertec(dot)at>
To: Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>
Cc: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: k-neighbourhood search in databases
Date: 2011-04-08 12:44:32
Message-ID: 6F1154B9-6F89-4A36-A0C8-1FB581F85A60@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

hello ...

i have put some research into that some time ago and as far as i have seen there is a 99% chance that no other database can do it the way we do it. it seems nobody comes even close to it (especially not in the flexibility-arena).

oracle: disgusting workaround ...
http://www.orafaq.com/usenet/comp.databases.oracle.misc/2005/11/03/0083.htm

db2: disgusting workaround (no server side code it seems)

sybase: disgusting workaround (no serverside code it seems)

microsoft: there seems to be something coming out (or just out) but i have not seen anything working yet.

regards,

hans

On Apr 8, 2011, at 2:21 PM, Oleg Bartunov wrote:

> Hi there,
>
> I'm interesting if other databases provides built-in effective knn search ? Google didn't help me.
>
> Regards,
> Oleg
> _____________________________________________________________
> Oleg Bartunov, Research Scientist, Head of AstroNet (www.astronet.ru),
> Sternberg Astronomical Institute, Moscow University, Russia
> Internet: oleg(at)sai(dot)msu(dot)su, http://www.sai.msu.su/~megera/
> phone: +007(495)939-16-83, +007(495)939-23-83
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>

--
Cybertec Schönig & Schönig GmbH
Gröhrmühlgasse 26
A-2700 Wiener Neustadt, Austria
Web: http://www.postgresql-support.de


From: Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>
To: PostgreSQL - Hans-Jürgen Schönig <postgres(at)cybertec(dot)at>
Cc: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: k-neighbourhood search in databases
Date: 2011-04-08 13:24:51
Message-ID: Pine.LNX.4.64.1104081722450.9772@sn.sai.msu.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hans,

thanks a lot. I've heard about Oracle Spatial, but I don't know
if it's knn is just syntactic sugar for workarounds.

Oleg

On Fri, 8 Apr 2011, PostgreSQL - Hans-J?rgen Sch?nig wrote:

> hello ...
>
> i have put some research into that some time ago and as far as i have seen there is a 99% chance that no other database can do it the way we do it. it seems nobody comes even close to it (especially not in the flexibility-arena).
>
> oracle: disgusting workaround ...
> http://www.orafaq.com/usenet/comp.databases.oracle.misc/2005/11/03/0083.htm
>
> db2: disgusting workaround (no server side code it seems)
>
> sybase: disgusting workaround (no serverside code it seems)
>
> microsoft: there seems to be something coming out (or just out) but i have not seen anything working yet.
>
> regards,
>
> hans
>
>
>
> On Apr 8, 2011, at 2:21 PM, Oleg Bartunov wrote:
>
>> Hi there,
>>
>> I'm interesting if other databases provides built-in effective knn search ? Google didn't help me.
>>
>> Regards,
>> Oleg
>> _____________________________________________________________
>> Oleg Bartunov, Research Scientist, Head of AstroNet (www.astronet.ru),
>> Sternberg Astronomical Institute, Moscow University, Russia
>> Internet: oleg(at)sai(dot)msu(dot)su, http://www.sai.msu.su/~megera/
>> phone: +007(495)939-16-83, +007(495)939-23-83
>>
>> --
>> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgsql-hackers
>>
>
> --
> Cybertec Sch?nig & Sch?nig GmbH
> Gr?hrm?hlgasse 26
> A-2700 Wiener Neustadt, Austria
> Web: http://www.postgresql-support.de
>

Regards,
Oleg
_____________________________________________________________
Oleg Bartunov, Research Scientist, Head of AstroNet (www.astronet.ru),
Sternberg Astronomical Institute, Moscow University, Russia
Internet: oleg(at)sai(dot)msu(dot)su, http://www.sai.msu.su/~megera/
phone: +007(495)939-16-83, +007(495)939-23-83


From: Josh Berkus <josh(at)agliodbs(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: k-neighbourhood search in databases
Date: 2011-04-08 19:58:47
Message-ID: 4D9F68F7.4030009@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 4/8/11 5:21 AM, Oleg Bartunov wrote:
> Hi there,
>
> I'm interesting if other databases provides built-in effective knn
> search ? Google didn't help me.

Nobody I've talked to, and I asked both Couch and Oracle devs.

--
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com


From: Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: k-neighbourhood search in databases
Date: 2011-04-09 03:38:23
Message-ID: Pine.LNX.4.64.1104090737110.9772@sn.sai.msu.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Fri, 8 Apr 2011, Josh Berkus wrote:

> On 4/8/11 5:21 AM, Oleg Bartunov wrote:
>> Hi there,
>>
>> I'm interesting if other databases provides built-in effective knn
>> search ? Google didn't help me.
>
> Nobody I've talked to, and I asked both Couch and Oracle devs.

That's great to know :)

Regards,
Oleg
_____________________________________________________________
Oleg Bartunov, Research Scientist, Head of AstroNet (www.astronet.ru),
Sternberg Astronomical Institute, Moscow University, Russia
Internet: oleg(at)sai(dot)msu(dot)su, http://www.sai.msu.su/~megera/
phone: +007(495)939-16-83, +007(495)939-23-83


From: Jeremiah Peschka <jeremiah(dot)peschka(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: k-neighbourhood search in databases
Date: 2011-04-09 04:39:14
Message-ID: 0E1159A898C147469F6923CAAC14D9E4@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


On 4/8/11 5:21 AM, Oleg Bartunov wrote:
> Hi there,
>
> I'm interesting if other databases provides built-in effective knn
> search ? Google didn't help me.
SQL Server provides some knn search functionality[1] with enhancements coming this November in SQL 11[2].

[1]: http://blogs.msdn.com/b/isaac/archive/2008/10/23/nearest-neighbors.aspx
[2]: http://www.sqlskills.com/BLOGS/BOBB/post/The-nearest-neighbor-optimization-in-SQL-Server-Denali.aspx

--
Jeremiah Peschka
Microsoft SQL Server MVP
MCITP: Database Developer, DBA


From: Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>
To: Jeremiah Peschka <jeremiah(dot)peschka(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: k-neighbourhood search in databases
Date: 2011-04-10 10:18:14
Message-ID: Pine.LNX.4.64.1104101415240.9772@sn.sai.msu.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Wow, custom solution for 2008 still much faster Denali 2011 solution.
Also, what's about not spatial data types ?
In our approach, we can provide knn for any datatype, which has GiST index
and distance method.

Oleg
On Fri, 8 Apr 2011, Jeremiah Peschka wrote:

>
> On 4/8/11 5:21 AM, Oleg Bartunov wrote:
>> Hi there,
>>
>> I'm interesting if other databases provides built-in effective knn
>> search ? Google didn't help me.
> SQL Server provides some knn search functionality[1] with enhancements coming this November in SQL 11[2].
>
> [1]: http://blogs.msdn.com/b/isaac/archive/2008/10/23/nearest-neighbors.aspx
> [2]: http://www.sqlskills.com/BLOGS/BOBB/post/The-nearest-neighbor-optimization-in-SQL-Server-Denali.aspx
>
>
>

Regards,
Oleg
_____________________________________________________________
Oleg Bartunov, Research Scientist, Head of AstroNet (www.astronet.ru),
Sternberg Astronomical Institute, Moscow University, Russia
Internet: oleg(at)sai(dot)msu(dot)su, http://www.sai.msu.su/~megera/
phone: +007(495)939-16-83, +007(495)939-23-83


From: Jesper Krogh <jesper(at)krogh(dot)cc>
To: Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>
Cc: Jeremiah Peschka <jeremiah(dot)peschka(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: k-neighbourhood search in databases
Date: 2011-04-10 14:24:54
Message-ID: 4DA1BDB6.90001@krogh.cc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 2011-04-10 12:18, Oleg Bartunov wrote:
> Wow, custom solution for 2008 still much faster Denali 2011 solution.
> Also, what's about not spatial data types ? In our approach, we can
> provide
> knn for any datatype, which has GiST index and distance method.

Can you share some insight about how it would
work if the distance method is "expensive" (as in 100ms)?

--
Jesper


From: Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>
To: Jesper Krogh <jesper(at)krogh(dot)cc>
Cc: Jeremiah Peschka <jeremiah(dot)peschka(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: k-neighbourhood search in databases
Date: 2011-04-10 17:45:12
Message-ID: Pine.LNX.4.64.1104102137260.9772@sn.sai.msu.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Sun, 10 Apr 2011, Jesper Krogh wrote:

> On 2011-04-10 12:18, Oleg Bartunov wrote:
>> Wow, custom solution for 2008 still much faster Denali 2011 solution.
>> Also, what's about not spatial data types ? In our approach, we can provide
>> knn for any datatype, which has GiST index and distance method.
>
> Can you share some insight about how it would
> work if the distance method is "expensive" (as in 100ms)?

I don't understand how does your question connected with my statement :)

Slow distance calculation affects gist-based ordered heap output as well as
seqscan output from heap, but in the first case you need to calculate just a
few distances (something like height of gist tree), while in the naive way
one have to calculate n^2 distances.

Regards,
Oleg
_____________________________________________________________
Oleg Bartunov, Research Scientist, Head of AstroNet (www.astronet.ru),
Sternberg Astronomical Institute, Moscow University, Russia
Internet: oleg(at)sai(dot)msu(dot)su, http://www.sai.msu.su/~megera/
phone: +007(495)939-16-83, +007(495)939-23-83


From: Jeremiah Peschka <jeremiah(dot)peschka(at)gmail(dot)com>
To: Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: k-neighbourhood search in databases
Date: 2011-04-10 22:54:03
Message-ID: B21C0BD017974CFFAAF25430488E55B9@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Sunday, April 10, 2011 at 3:18 AM, Oleg Bartunov wrote:
Wow, custom solution for 2008 still much faster Denali 2011 solution.
> Also, what's about not spatial data types ?
> In our approach, we can provide knn for any datatype, which has GiST index
> and distance method.
>

There are a number of workarounds (custom data types, mainly) that can be done in SQL Server, but the spatial datatypes themselves are .NET datatypes that ship with SQL Server and I'm pretty sure the methods will only work with the spatial types. The other types are the usual primitives that we all know and love and won't respond to .NET method invocation in the database.

--
Jeremiah Peschka
Microsoft SQL Server MVP
MCITP: Database Developer, DBA

> Oleg
> On Fri, 8 Apr 2011, Jeremiah Peschka wrote:
>
> >
> > On 4/8/11 5:21 AM, Oleg Bartunov wrote:
> > > Hi there,
> > >
> > > I'm interesting if other databases provides built-in effective knn
> > > search ? Google didn't help me.
> > SQL Server provides some knn search functionality[1] with enhancements coming this November in SQL 11[2].
> >
> > [1]: http://blogs.msdn.com/b/isaac/archive/2008/10/23/nearest-neighbors.aspx
> > [2]: http://www.sqlskills.com/BLOGS/BOBB/post/The-nearest-neighbor-optimization-in-SQL-Server-Denali.aspx
>
> Regards,
> Oleg
> _____________________________________________________________
> Oleg Bartunov, Research Scientist, Head of AstroNet (www.astronet.ru),
> Sternberg Astronomical Institute, Moscow University, Russia
> Internet: oleg(at)sai(dot)msu(dot)su, http://www.sai.msu.su/~megera/
> phone: +007(495)939-16-83, +007(495)939-23-83
>