Re: Cube extension kNN support

From: Stas Kelvich <s(dot)kelvich(at)postgrespro(dot)ru>
To: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Sergey Konoplev <gray(dot)ru(at)gmail(dot)com>, Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Cube extension kNN support
Date: 2015-10-30 01:51:05
Message-ID: 14876F35-0A31-444C-9914-E4C1978BDD80@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello.

That is updated version of the patch with proper update scripts.

Also i’ve noted that documentation states the wrong thing:

“It does not matter which order the opposite corners of a cube are entered in. The cube functions automatically swap values if needed to create a uniform "lower left — upper right" internal representation."

But in practice cubes stored "as is" and that leads to problems with getting cubes sorted along specific dimension directly from index.
As a simplest workaround i’ve deleted that sentence from docs and implemented two coordinate getters -> and ~>. First one returns
coordinate of cube as it stored, and second returns coordinate of cube normalised to (LL,UR)-form.

Other way to fix thing is to force ’normalization’ while creating cube. But that can produce wrong sorts with already existing data.

> On 09 Jul 2015, at 16:40, Alexander Korotkov <aekorotkov(at)gmail(dot)com> wrote:
>
> Hi!
>
> On Sat, May 9, 2015 at 6:53 AM, Stas Kelvich <stas(dot)kelvich(at)gmail(dot)com> wrote:
> Patch is pretty ready, last issue was about changed extension interface, so there should be migration script and version bump.
> Attaching a version with all migration stuff.
>
> I can't see cube--1.0--1.1.sql in the patch. Did forget to include it?
>
> ------
> Alexander Korotkov
> Postgres Professional: http://www.postgrespro.com
> The Russian Postgres Company

Stas Kelvich
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

Attachment Content-Type Size
distances.patch application/octet-stream 68.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim Nasby 2015-10-30 02:22:13 Re: pgxs/config/missing is... missing
Previous Message Peter Geoghegan 2015-10-30 00:37:46 Re: Are we sufficiently clear that jsonb containment is nested?