Re: MIN/MAX optimization for partitioned table

From: Greg Stark <gsstark(at)mit(dot)edu>
To: Alan Li <ali(at)truviso(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: MIN/MAX optimization for partitioned table
Date: 2009-07-18 10:13:19
Message-ID: 407d949e0907180313g349d1f2dref273631c138559d@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dimitri Fontaine 2009-07-18 10:14:11 Re: WIP patch for TODO Item: Add prompt escape to display the client and server versions
Previous Message Dean Rasheed 2009-07-18 10:09:54 Re: Index AM API changes for deferability