Re: BRIN indexes for MAX, MIN, ORDER BY?

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Marti Raudsepp <marti(at)juffo(dot)org>, Gavin Wahl <gavinwahl(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: BRIN indexes for MAX, MIN, ORDER BY?
Date: 2015-09-28 15:23:25
Message-ID: 56095B6D.6030106@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 09/28/2015 05:28 PM, Marti Raudsepp wrote:
> Note that Alexander Korotkov already started work in 2013 on a
> somewhat similar feature called partial sort:
> http://www.postgresql.org/message-id/CAPpHfdscOX5an71nHd8WSUH6GNOCf=V7wgDaTXdDd9=goN-gfA@mail.gmail.com
>
> In particular, see the 2nd patch for KNN sort -- it uses known
> bounding boxes from the GiST index for sorting, which in many ways is
> similar to min/max BRIN ranges.
>
>> *partial-knn-1.patch*
>>
>> KNN-GiST provides ability to get ordered results from index, but this order
>> is based only on index information. For instance, GiST index contains
>> bounding rectangles for polygons, and we can't get exact distance to
>> polygon from index (similar situation is in PostGIS). In attached patch,
>> GiST distance method can set recheck flag (similar to consistent method).
>> This flag means that distance method returned lower bound of distance and
>> we should recheck it from heap.
>
> Unfortunatley this work has stalled.

No, that was actually committed for 9.5. It's this item in the release
notes:

> Allow queries to perform accurate distance filtering of
> bounding-box-indexed objects (polygons, circles) using GiST indexes
> (Alexander Korotkov, Heikki Linnakangas)
>
> Previously, a common table expression was required to return a large
> number of rows ordered by bounding-box distance, and then filtered
> further with a more accurate non-bounding-box distance calculation.

- Heikki

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David Fetter 2015-09-28 15:23:46 Re: No Issue Tracker - Say it Ain't So!
Previous Message Robert Haas 2015-09-28 15:20:17 Re: RLS open items are vague and unactionable