Re: KNN-GiST with recheck

From: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Emre Hasegeli <emre(at)hasegeli(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
Subject: Re: KNN-GiST with recheck
Date: 2014-09-26 06:49:42
Message-ID: CAPpHfdvDMS1_jqnzZ0FbGePWwCvStj4_h0xU2hYTnLcC6of3Rg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Sep 26, 2014 at 5:18 AM, Bruce Momjian <bruce(at)momjian(dot)us> wrote:

> On Sun, Sep 14, 2014 at 11:34:26PM +0400, Alexander Korotkov wrote:
> > > Cost estimation of GiST is a big problem anyway. It doesn't care
> (and
> > > can't) about amount of recheck for regular operators. In this
> patch, same
> > > would be for knn recheck. The problem is that touching heap from
> access
>
> This is very important work. While our existing KNN-GiST index code
> works fine for scalar values and point-to-point distance ordering, it
> doesn't work well for 2-dimensional objects because they are only
> indexed by their bounding boxes (a rectangle around the object). The
> indexed bounding box can't produce accurate distances to other objects.
>
> As an example, see this PostGIS blog post showing how to use LIMIT in a
> CTE to filter results and then compute the closest object (search for
> "LIMIT 50"):
>
>
> http://shisaa.jp/postset/postgis-postgresqls-spatial-partner-part-3.html
>
> This patch fixes our code for distances from a point to indexed 2-D
> objects.
>
> Does this also fix the identical PostGIS problem or is there something
> PostGIS needs to do?
>

This patch provides general infrastructure for recheck in KNN-GiST. PostGIS
need corresponding change in its GiST opclass. Since PostGIS already define
<-> and <#> operators as distance to bounding box border and bounding box
center, it can't change their behaviour.
it has to support new operator "exact distance" in opclass.

------
With best regards,
Alexander Korotkov.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2014-09-26 06:53:55 Re: TODO : Allow parallel cores to be used by vacuumdb [ WIP ]
Previous Message Josh Berkus 2014-09-26 04:40:19 Re: jsonb format is pessimal for toast compression