db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Army <qoz...@sbcglobal.net>
Subject Re: [OPTIMIZER] Proposal for pushing join predicates into Unions posted to DERBY-805.
Date Mon, 13 Feb 2006 16:35:14 GMT
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.


View raw message