Re: Query planner suggestion, for indexes with similar but not exact ordering. - Mailing list pgsql-performance

From Robert Haas
Subject Re: Query planner suggestion, for indexes with similar but not exact ordering.
Date
Msg-id CA+Tgmob8zSgSe5Od4s17i4dSbnOcuL5otchEUAVH-OM=rciJ-A@mail.gmail.com
Whole thread Raw
In response to Query planner suggestion, for indexes with similar but not exact ordering.  (Andrew Barnham <andrew.barnham@gmail.com>)
List pgsql-performance
On Mon, Nov 14, 2011 at 5:22 PM, Andrew Barnham
<andrew.barnham@gmail.com> wrote:
> I wonder, if it is possible and worthwhile, to setup the query planner to
> recognize that because of the stats I indicate above, that a sort by partnum
> is almost exactly the same as a sort by partnum+franchise.  And doing a
> Index scan on partnum index, and sorting results in memory will be
> dramatically faster.  The sort buffer only needs to be very small, will only
> grow to 8 records only at most in my above example.  The buffer will scan
> partnum index, and as long as partnum is the same, it will sort that small
> segment, as soon as the partnum increments when walking the index, the
> buffer zeros out again for next sort group.

This has come up before and seems worthwhile, but nobody's implemented it yet.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

pgsql-performance by date:

Previous
From: Leonardo Francalanci
Date:
Subject: Re: Guidance Requested - Bulk Inserting + Queries
Next
From: Robert Haas
Date:
Subject: Re: Problems with FTS