Re: [PATCH] Partial indicies again - Mailing list pgsql-general

From Tom Lane
Subject Re: [PATCH] Partial indicies again
Date
Msg-id 26158.994724563@sss.pgh.pa.us
Whole thread Raw
In response to Re: [PATCH] Partial indicies again  (Martijn van Oosterhout <kleptog@svana.org>)
Responses Re: [PATCH] Partial indicies again  (Martijn van Oosterhout <kleptog@svana.org>)
List pgsql-general
Martijn van Oosterhout <kleptog@svana.org> writes:
>> I suspect you need to run cnfify after and-ing together the predicate
>> and index quals.  clauselist_selectivity assumes it's working on
>> cnf'ified expressions.

> OK. Do I need to worry about that function destroying either of the input
> lists?

AFAIR, cnfify doesn't modify its inputs.  But watch out for the
difference between explicit and implicit ANDing.

> I'll have to check again, but I thought that the VACUUM code only had the
> OID of the index, so how it is supposed to work out if it's a partial index.

You'll need to look it up.

In practice, I seem to recall that VACUUM is broken for partial indexes
anyway, specifically because it does not pay attention to partial-ness:
when it moves a tuple it shouldn't make an index entry for the new copy
if the index is partial and the tuple fails the predicate check.  The
correct fix for this is not to add code, but to remove it.  VACUUM
should never have had its own index-entry-making code in the first
place; it should be using ExecOpenIndices and friends from the main
executor.  Once you do that, the info returned by ExecOpenIndices will
include the predicate, and you can just look there.

            regards, tom lane

pgsql-general by date:

Previous
From: "Matt Block"
Date:
Subject: Syncing multple servers
Next
From: Doug McNaught
Date:
Subject: Re: Re: Backups WAS: 2 gig file size limit