Re: plan time of MASSIVE partitioning ...

Boszormenyi Zoltan <zb@cybertec.at>

From: Boszormenyi Zoltan <zb@cybertec.at>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Alvaro Herrera <alvherre@commandprompt.com>, Stephen Frost <sfrost@snowman.net>, Hans-Jürgen Schönig <postgres@cybertec.at>, Robert Haas <robertmhaas@gmail.com>, pgsql-hackers Hackers <pgsql-hackers@postgresql.org>, Josh Berkus <josh@agliodbs.com>
Date: 2010-10-19T19:50:55Z
Lists: pgsql-hackers
Hi,

Boszormenyi Zoltan írta:
> There is one problem with the patch, it doesn't survive
> "make check". One of the regression tests fails the
>     Assert(!cur_em->em_is_child);
> line in process_equivalence() in equivclass.c, but I couldn't
> yet find it what causes it. The "why" is vaguely clear:
> something modifies the ec_members list in the eq_classes'
> tree nodes while the node is in the tree. Because I didn't find
> the offender yet, I couldn't fix it, so I send this patch as is.
> I'll try to fix it if someone doesn't beat me in fixing it. :)
>   

I am a little closer to this bug, maybe I even found the cause of it.
I found that process_equivalence() is called from:

path/equivclass.c:
    reconsider_outer_join_clause()
    reconsider_full_join_clause()
plan/initsplan.c:
    distribute_qual_to_rels()

The problem is with the two functions in path/equivclass.c,
as process_equivalance() and those functions are all walk
the tree, and the current RBTree code can only deal with
one walk at a time. We need to push/pop the iterator state
to be able to serve more than one walkers.

Also, we need to split out the tree modifying part from
process_equivalence() somehow, as the tree walking
also cannot deal with node additions and deletions.

Best regards,
Zoltán Böszörményi

-- 
----------------------------------
Zoltán Böszörményi
Cybertec Schönig & Schönig GmbH
Gröhrmühlgasse 26
A-2700 Wiener Neustadt, Austria
Web: http://www.postgresql-support.de
     http://www.postgresql.at/