You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by Jeffrey Lichtman <sw...@rcn.com> on 2006/02/13 10:11:50 UTC

Re: [OPTIMIZER] Proposal for pushing join predicates into Unions posted to DERBY-805.

>4 - Make sure predicates that are pushed down into subqueries of a 
>UnionNode are correctly "pulled" back up (if they are unscoped) or 
>discarded (if they are scoped) for every permutation seen during optimization.

Predicates may have to be copied when pushed into the children of a 
UnionNode. When the predicates are pulled back up out of the 
UnionNode, all but one copy of each will have to be discarded. Please 
watch out for whether this causes performance problems due to object 
creation and garbage collection. If such problems exist, it may be 
possible to cache copies of predicates for re-use.


                        -        Jeff Lichtman
                                 swazoo@rcn.com
                                 Check out Swazoo Koolak's Web Jukebox at
                                 http://swazoo.com/ 


Re: [OPTIMIZER] Proposal for pushing join predicates into Unions posted to DERBY-805.

Posted by Army <qo...@sbcglobal.net>.
Jeffrey Lichtman wrote:
> 
>> 4 - Make sure predicates that are pushed down into subqueries of a 
>> UnionNode are correctly "pulled" back up (if they are unscoped) or 
>> discarded (if they are scoped) for every permutation seen during 
>> optimization.
> 
> Predicates may have to be copied when pushed into the children of a 
> UnionNode. When the predicates are pulled back up out of the UnionNode, 
> all but one copy of each will have to be discarded. 

Yes.  The way I do this now to keep a pointer to the original, unscoped 
predicate and push newly created, "scoped" predicates (one for each child) down 
to the children.  When it comes time to pull, I pull the unscoped predicate 
(which serves as the "all but one copy" that you mentioned) and discard the 
scoped ones.

> Please watch out for whether this causes performance problems due to 
> object creation and garbage collection. If such problems exist, it may 
> be possible to cache copies of predicates for re-use.

Good point, thanks for mentioning this.  The code right will rescope the 
predicate for each child for every permutation, which as you said could cause 
performance problems with object creation.  I will look at this to see if I can 
cache the scoped predicates for re-use, so that we don't end up re-scoping the 
same predicate for the same children for every permutation.

Army