Changeset: 9426d3d5c3e8 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/9426d3d5c3e8
Modified Files:
        monetdb5/optimizer/opt_fastpath.c
Branch: Mar2025
Log Message:

Stop scan if we have enough information.


diffs (59 lines):

diff --git a/monetdb5/optimizer/opt_fastpath.c 
b/monetdb5/optimizer/opt_fastpath.c
--- a/monetdb5/optimizer/opt_fastpath.c
+++ b/monetdb5/optimizer/opt_fastpath.c
@@ -59,15 +59,22 @@ OPTminimalfastImplementation(Client cntx
                                                         InstrPtr pci)
 {
        str msg = MAL_SUCCEED;
-       int generator = 0, multiplex = 0, actions = 0;
+       bool generator = false, multiplex = true;
+       int actions = 0;
 
        /* perform a single scan through the plan to determine which optimizer 
steps to skip */
        for (int i = 0; i < mb->stop; i++) {
                InstrPtr q = getInstrPtr(mb, i);
-               if (getModuleId(q) == generatorRef)
-                       generator = 1;
-               if (getFunctionId(q) == multiplexRef)
-                       multiplex = 1;
+               if (getModuleId(q) == generatorRef) {
+                       generator = true;
+                       if (multiplex)
+                               break;
+               }
+               if (getFunctionId(q) == multiplexRef) {
+                       multiplex = true;
+                       if (generator)
+                               break;
+               }
        }
 
        optcall(true, OPTinlineImplementation);
@@ -94,15 +101,22 @@ OPTdefaultfastImplementation(Client cntx
                                                         InstrPtr pci)
 {
        str msg = MAL_SUCCEED;
-       int generator = 0, multiplex = 0, actions = 0;
+       bool generator = false, multiplex = false;
+       int actions = 0;
 
        /* perform a single scan through the plan to determine which optimizer 
steps to skip */
        for (int i = 0; i < mb->stop; i++) {
                InstrPtr q = getInstrPtr(mb, i);
-               if (getModuleId(q) == generatorRef)
-                       generator = 1;
-               if (getFunctionId(q) == multiplexRef)
-                       multiplex = 1;
+               if (getModuleId(q) == generatorRef) {
+                       generator = true;
+                       if (multiplex)
+                               break;
+               }
+               if (getFunctionId(q) == multiplexRef) {
+                       multiplex = true;
+                       if (generator)
+                               break;
+               }
        }
 
        optcall(true, OPTinlineImplementation);
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to