Re: MIN/MAX optimization for partitioned table - Mailing list pgsql-hackers

From Greg Stark
Subject Re: MIN/MAX optimization for partitioned table
Date
Msg-id 407d949e0907180313g349d1f2dref273631c138559d@mail.gmail.com
Whole thread Raw
In response to Re: MIN/MAX optimization for partitioned table  (Alan Li <ali@truviso.com>)
Responses Re: MIN/MAX optimization for partitioned table  (Alan Li <ali@truviso.com>)
List 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


pgsql-hackers by date:

Previous
From: Dean Rasheed
Date:
Subject: Re: Index AM API changes for deferability
Next
From: Dimitri Fontaine
Date:
Subject: Re: WIP patch for TODO Item: Add prompt escape to display the client and server versions