Skip site navigation (1) Skip section navigation (2)

Re: GEQO vs join order restrictions

From: Andres Freund <andres(at)anarazel(dot)de>
To: pgsql-hackers(at)postgresql(dot)org
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>
Subject: Re: GEQO vs join order restrictions
Date: 2009-07-22 20:09:05
Message-ID: 200907222209.05489.andres@anarazel.de (view raw or flat)
Thread:
Lists: pgsql-hackers
Hi Tom, Robert, Hi all,
nks,
On Sunday 19 July 2009 19:23:18 Tom Lane wrote:
> Andres Freund <andres(at)anarazel(dot)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

In response to

pgsql-hackers by date

Next:From: Robert HaasDate: 2009-07-22 20:11:59
Subject: Re: extension facility (was: revised hstore patch)
Previous:From: decibelDate: 2009-07-22 19:35:44
Subject: Fwd: [HACKERS] Commitfest Code Sprint with PUGs

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group