On 29 September 2015 at 13:20, Jeremy Harris <j...@wizmail.org> wrote:
> On 27/09/15 21:58, Gavin Wahl wrote:
> > Somewhat harder but still possible would be using BRIN indexes to
> > accelerate ORDER BY. This would require a sorting algorithm that can take
> > advantage of mostly-sorted inputs. You would sort the page ranges by
> > minimum or maximum value, then feed the sorting algorithm in that order.
> An internal merge sort does well with partially-sorted input.
Yes, the $SUBJECT would be a valid use for BRIN.
And also in general for sorts, leading to an optimization of merge joins
using BRIN indexes.
All this was foreseen in the original design; if it really was trivial it
would be in 9.5 already...
Simon Riggs http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services