Re: GEQO vs join order restrictions - Mailing list pgsql-hackers

From Andres Freund
Subject Re: GEQO vs join order restrictions
Date
Msg-id 200907222209.05489.andres@anarazel.de
Whole thread Raw
In response to Re: GEQO vs join order restrictions  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Hi Tom, Robert, Hi all,
nks,
On Sunday 19 July 2009 19:23:18 Tom Lane wrote:
> Andres Freund <andres@anarazel.de> writes:
> > On Saturday 18 July 2009 17:48:14 Tom Lane wrote:
> >> I'm inclined to address this by rewriting gimme_tree so that it *always*
> >> finds a valid join order based on the given tour.  This would involve
> >> searching the whole stack for a possible join partner instead of
> >> considering only the topmost stack entry.  It sounds inefficient, but
> >> it's not nearly as bad as wasting the entire cycle by failing near
> >> the end, which is what happens now.
> >
> > I guess this should be relatively easy to implement and test?
> With the patch, GEQO manages to bumble through and produce a plan
> even at high collapse limits.  It's a whole lot slower than the
> regular planner, and I found out that this time consists largely
> of desirable_join() checks in gimme_tree().  I said earlier that
> the regular planner does that too ... but GEQO is doing it a lot
> more, because it repeats the whole planning cycle 500 times.
> In previous tests we've seen regular planner runtime cross over
> GEQO time around collapse_limit 12.  It seems the reason that
> this case is so different is that the total problem is so much
> larger, and so there is a very large equivalence-class list
> (1289 items!) that gets trawled through in each desirable_join check.
> That's why have_relevant_eclass_joinclause shows up so high in oprofile.

> My conclusions are:
> 1.  I should clean up and apply the attached patch.  Even though it's
> not the whole answer, it clearly makes things a good deal better.
I did some testing with the original queries and the unsurprising result is, 
that the planning time is *hugely* smaller (multiple orders of magnitude) and 
the execution time is bigger (~15% ) with the few variation of settings I 
tested.

Many unplanable queries are now planable. 

Thanks,

Andres


pgsql-hackers by date:

Previous
From: Andreas Wenk
Date:
Subject: Re: psql - small fix in \du
Next
From: Robert Haas
Date:
Subject: Re: extension facility (was: revised hstore patch)