Re: [GENERAL] Question about partial functional indexes and the query planner

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Brian Dunavant <brian(at)omniti(dot)com>, PGSQL Mailing List <pgsql-general(at)postgresql(dot)org>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [GENERAL] Question about partial functional indexes and the query planner
Date: 2014-06-11 23:24:36
Message-ID: 32311.1402529076@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> On Tue, Jun 10, 2014 at 7:19 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> Given the lack of previous complaints, I'm not sure this amounts to
>> a back-patchable bug, but it does seem like something worth fixing
>> going forward.

> Agreed, although I'd be willing to see us slip it into 9.4. It's
> doubtful that anyone will get upset if their query plans change
> between beta1 and beta2, but the same cannot be said for released
> branches.

After further thought about this I realized that there's another category
of proof possibilities that is pretty simple to add while we're at it.
Namely, once we've found that both subexpressions of the two operator
clauses are equal(), we can use btree opclass relationships to prove that,
say, "x < y implies x <= y" or "x < y refutes x > y", independently of
just what x and y are. (Well, they have to be immutable expressions, but
we'd not get this far if they're not.) We already had pretty nearly all
of the machinery for that, but again it was only used for proving cases
involving comparisons to constants.

A little bit of refactoring later, I offer the attached draft patch.
I'm thinking this is probably more than we want to slip into 9.4
at this point, but I'll commit it to HEAD soon if there are not
objections.

regards, tom lane

Attachment Content-Type Size
better-predicate-proofs-1.patch text/x-diff 31.5 KB

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Si Chen 2014-06-12 02:44:09 Re: what does pg_activity mean when the database is stuck?
Previous Message Merlin Moncure 2014-06-11 23:23:48 Re: max_connections reached in postgres 9.3.3

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2014-06-11 23:46:56 Re: API change advice: Passing plan invalidation info from the rewriter into the planner?
Previous Message Fabrízio de Royes Mello 2014-06-11 22:27:21 Re: view reloptions