Re: BRIN indexes for MAX, MIN, ORDER BY? - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: BRIN indexes for MAX, MIN, ORDER BY?
Date
Msg-id 56095B6D.6030106@iki.fi
Whole thread Raw
In response to Re: BRIN indexes for MAX, MIN, ORDER BY?  (Marti Raudsepp <marti@juffo.org>)
List 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



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: RLS open items are vague and unactionable
Next
From: David Fetter
Date:
Subject: Re: No Issue Tracker - Say it Ain't So!