Planner avoidance of index only scans for partial indexes - Mailing list pgsql-hackers

From Merlin Moncure
Subject Planner avoidance of index only scans for partial indexes
Date
Msg-id CAHyXU0x1OGao48WajAfUsbXqkUDLf=_6ho6hLMB8DSfkWdaVVw@mail.gmail.com
Whole thread Raw
Responses Re: Planner avoidance of index only scans for partial indexes
Re: Planner avoidance of index only scans for partial indexes
List 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



pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: B-tree parent pointer and checkpoints
Next
From: Bruce Momjian
Date:
Subject: Re: [COMMITTERS] pgsql: Clean up the #include mess a little.