Re: Idea for reducing planning time - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Idea for reducing planning time
Date
Msg-id 12895.976907203@sss.pgh.pa.us
Whole thread Raw
In response to Re: Idea for reducing planning time  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-hackers
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> My quick question is that if we have a1=b1 and b1=c1, isn't the join
> sorted by a1, b1, and c1, and threfore we don't get more sorted plans?

That's not the issue.  See, before the transitive-equality patch,
if you wrote
select * from a,b,c where a.x = b.y and b.y = c.z

then the system would not consider plans of the structure {a c} b
(ie, start with a join of a to c and then add b).  It would only
consider {a b} c and {b c} a plans, because it follows join clauses
if any are available.

Now that we deduce the additional WHERE clause a.x = c.z, we will
also consider {a c} b.  So we may get a better plan as a result ...
but whether we give back the same plan or not, it takes longer,
because more paths will be considered.  Brian Hirt was unhappy because
planning was taking significantly longer on his seven-way join.


> Did you lose the argument with Vadim?  I haven't seen his vacuum commit
> yet, though I certainly would like to.  :-)

I'm assuming he's going to commit it, though I haven't seen him say so
in so many words.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Idea for reducing planning time
Next
From: "Oliver Elphick"
Date:
Subject: 7.1 (current) unwanted NOT NULL constraint inserted (more)