Re: planner missing a trick for foreign tables w/OR conditions - Mailing list pgsql-hackers

From Tom Lane
Subject Re: planner missing a trick for foreign tables w/OR conditions
Date
Msg-id 18548.1387238352@sss.pgh.pa.us
Whole thread Raw
In response to Re: planner missing a trick for foreign tables w/OR conditions  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: planner missing a trick for foreign tables w/OR conditions
List pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
> On Mon, Dec 16, 2013 at 2:04 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> The problem is that that optimization is a crock; see the comments
>> for create_or_index_quals().  We can't just turn it loose to CNF-ify
>> every OR it might find.  The case that we support at the moment is
>> to CNF-ify whichever single OR condition looks like the best win,
>> and it's hard to see how to do that without any index knowledge.

> Could we get by without actually converting to CNF?

The hard part is not extracting the partial qual.  The hard part is
trying to make sure that adding this entirely-redundant scan qual doesn't
catastrophically degrade join size estimates.  The hack of making an
inverse adjustment to the original OR clause's selectivity works, more or
less, for a single join OR condition.  I don't think it works if there's
several modified OR conditions (possibly covering different sets of
relations).
        regards, tom lane



pgsql-hackers by date:

Previous
From: Jeff Janes
Date:
Subject: Cost estimation problem on seq scan in a loop
Next
From: Greg Stark
Date:
Subject: Re: Cost estimation problem on seq scan in a loop