Planner avoidance of index only scans for partial indexes

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Planner avoidance of index only scans for partial indexes
Date: 2012-08-15 22:28:10
Message-ID: CAHyXU0x1OGao48WajAfUsbXqkUDLf=_6ho6hLMB8DSfkWdaVVw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

If you create an index like this:

create index on foo(a,b,v) where d = some_constant;

there is no way to get an IOS on the index: you have to supply a the
partial index exclusionary value to get the value of the index and
that fools the IOS chooser because it doesn't see the value in the
explicit list of index columns. The workaround is to include the
'partial value' (d) in the index, but often that's unnecessary.

In other words, if you have a partial index that is based on a
constant, a query that is filtering on the constant is an exception to
the rule that all columns must be in the index to get the IOS. Not a
bug, but it's worth noting.

Aside: the performance gains I'm seeing for IOS are nothing short of
spectacular.

merlin

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2012-08-15 22:30:40 Re: [COMMITTERS] pgsql: Clean up the #include mess a little.
Previous Message Bruce Momjian 2012-08-15 22:23:15 Re: B-tree parent pointer and checkpoints