Changeset: 3fd82fe82475 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/3fd82fe82475
Modified Files:
        monetdb5/optimizer/opt_mitosis.c
        monetdb5/optimizer/opt_mitosis.h
Branch: Dec2025
Log Message:

Decrease maximum number of slices into which a table is partitioned.


diffs (68 lines):

diff --git a/monetdb5/optimizer/opt_mitosis.c b/monetdb5/optimizer/opt_mitosis.c
--- a/monetdb5/optimizer/opt_mitosis.c
+++ b/monetdb5/optimizer/opt_mitosis.c
@@ -13,6 +13,7 @@
 #include "mal_interpreter.h"
 #include "gdk_utils.h"
 
+#define MAXSLICES 128                  /* to be refined */
 #define MIN_PART_SIZE 100000   /* minimal record count per partition */
 #define MAX_PARTS2THREADS_RATIO 4      /* There should be at most this 
multiple more of partitions than threads */
 
@@ -21,15 +22,19 @@ str
 OPTmitosisImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk,
                                                 InstrPtr pci)
 {
-       int i, j, limit, slimit, pieces = 1, mito_parts = 0,
-               mito_size = 0, row_size = 0, mt = -1, nr_cols = 0, nr_aggrs = 0,
-               nr_maps = 0;
-       str schema = 0, table = 0;
-       BUN r = 0, rowcnt = 0;          /* table should be sizeable to consider 
parallel execution */
+       int i, j, limit, slimit, pieces = 1, mito_parts = 0;
+       int mito_size = 0, row_size = 0, mt = -1, nr_cols = 0, nr_aggrs = 0;
+       int nr_maps = 0;
+       const char *schema = NULL;
+       const char *table = NULL;
+       BUN r = 0;
+       BUN rowcnt = 0;         /* table should be sizeable to consider 
parallel execution */
        InstrPtr p, q, *old, target = 0;
-       size_t argsize = 6 * sizeof(lng), m = 0;
+       size_t argsize = 6 * sizeof(lng);
+       size_t m = 0;
        /*       estimate size per operator estimate:   4 args + 2 res */
-       int threads = GDKnr_threads ? GDKnr_threads : 1, maxparts = MAXSLICES;
+       int threads = GDKnr_threads ? GDKnr_threads : 1;
+       int maxparts = MAXSLICES;
        str msg = MAL_SUCCEED;
 
        /* if the user has associated limitation on the number of threads, 
respect it in the
@@ -58,7 +63,7 @@ OPTmitosisImplementation(Client cntxt, M
 
                /* mitosis/mergetable bailout conditions */
                /* Crude protection against self join explosion */
-               if (p->retc == 2 && isMatJoinOp(p))
+               if (p->retc == 2 && isMatJoinOp(p) && threads < maxparts)
                        maxparts = threads;
 
                nr_aggrs += (p->argc > 2 && getModuleId(p) == aggrRef);
@@ -186,7 +191,7 @@ OPTmitosisImplementation(Client cntxt, M
                 * |threads| partitions at a time fit in memory,
                 * i.e., (threads*(rowcnt/pieces) <= m),
                 * i.e., (rowcnt/pieces <= m/threads),
-                * i.e., (pieces => rowcnt/(m/threads))
+                * i.e., (pieces >= rowcnt/(m/threads))
                 * (assuming that (m > threads*MIN_PART_SIZE)) */
                /* the number of pieces affects SF-100, going beyond 8x 
increases
                 * the optimizer costs beyond the execution time
diff --git a/monetdb5/optimizer/opt_mitosis.h b/monetdb5/optimizer/opt_mitosis.h
--- a/monetdb5/optimizer/opt_mitosis.h
+++ b/monetdb5/optimizer/opt_mitosis.h
@@ -12,8 +12,6 @@
 #define _OPT_MITOSIS_
 #include "opt_support.h"
 
-#define MAXSLICES 1024                 /* to be refined */
-
 extern str OPTmitosisImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk,
                                                                        
InstrPtr p);
 
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to