Re: Query planner suggestion, for indexes with similar but not exact ordering.

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Andrew Barnham <andrew(dot)barnham(at)gmail(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Query planner suggestion, for indexes with similar but not exact ordering.
Date: 2011-11-30 20:50:47
Message-ID: CA+Tgmob8zSgSe5Od4s17i4dSbnOcuL5otchEUAVH-OM=rciJ-A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Mon, Nov 14, 2011 at 5:22 PM, Andrew Barnham
<andrew(dot)barnham(at)gmail(dot)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

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Robert Haas 2011-11-30 20:58:28 Re: Problems with FTS
Previous Message Leonardo Francalanci 2011-11-30 16:17:33 Re: Guidance Requested - Bulk Inserting + Queries