Changeset: 070707c4bb0b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/070707c4bb0b
Modified Files:
monetdb5/optimizer/opt_commonTerms.c
monetdb5/optimizer/opt_constants.c
Branch: default
Log Message:
Refine the optimizers to not skip sql.tid duplicate elimination
diffs (42 lines):
diff --git a/monetdb5/optimizer/opt_commonTerms.c
b/monetdb5/optimizer/opt_commonTerms.c
--- a/monetdb5/optimizer/opt_commonTerms.c
+++ b/monetdb5/optimizer/opt_commonTerms.c
@@ -131,6 +131,11 @@ OPTcommonTermsImplementation(Client cntx
pushInstruction(mb,p);
continue;
}
+ /* simple SQL bind operations need not be merged, they are
cheap and/or can be duplicated eliminated elsewhere cheaper */
+ if( getModuleId(p) == sqlRef && getFunctionId(p) != tidRef){
+ pushInstruction(mb,p);
+ continue;
+ }
/* from here we have a candidate to look for a match */
@@ -147,7 +152,7 @@ OPTcommonTermsImplementation(Client cntx
bailout = 1024 ; // don't run over long collision list
/* Look into the hash structure for matching instructions */
for (j = hash[h]; j > 0 && bailout-- > 0 ; j = list[j])
- if ( (q= getInstrPtr(mb,j)) && getFunctionId(q) ==
getFunctionId(p) && getModuleId(q) == getModuleId(p) && getModuleId(p) !=
sqlRef){
+ if ( (q= getInstrPtr(mb,j)) && getFunctionId(q) ==
getFunctionId(p) && getModuleId(q) == getModuleId(p)){
TRC_DEBUG(MAL_OPTIMIZER, "Candidate[%d->%d] %d
%d :%d %d %d=%d %d %d %d\n",
j, list[j],
hasSameSignature(mb, p, q),
diff --git a/monetdb5/optimizer/opt_constants.c
b/monetdb5/optimizer/opt_constants.c
--- a/monetdb5/optimizer/opt_constants.c
+++ b/monetdb5/optimizer/opt_constants.c
@@ -57,7 +57,13 @@ OPTconstantsImplementation(Client cntxt,
for(i=0; i<mb->stop; i++){
q = getInstrPtr(mb,i);
- if( hasSideEffects(mb, q, 1) || getModuleId(q) == sqlRef )
+ if ( !q) {
+ continue;
+ }
+ if ( getModuleId(p) == sqlRef && getFunctionId(p) != tidRef) {
+ continue;
+ }
+ if( hasSideEffects(mb, q, 1) )
continue;
for(k= q->retc; k < q->argc; k++){
j = getArg(q,k);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list