This part:

!               /* only try to optimize children rel's */
!               foreach (lc, root->append_rel_list)
!               {
!                       AppendRelInfo *a = (AppendRelInfo *) lfirst(lc);
!                       
!                       if (a->child_relid == childrel->relid &&
!                               a->parent_relid == parentrel->relid)
!                       {
!                               appinfo = a;
!                               break;
!                       }
!               }

Looks like O(n^2). I guess that's a bigger problem than with just this
patch. Perhaps append_rel_list should be a dynahash in general. I
never really understood why it was simpler to have a single global
append_rel_list anyways.

The other thing is it would be nice if we could avoid making separate
subplans for each child and instead make one for the whole structure
including the aggregate. It would at the very least make the explain
output prettier, but I think it would avoid repeated execution of the
aggregate in some cases as well.

-- 
greg
http://mit.edu/~gsstark/resume.pdf

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to