Changeset: af72ae9ce826 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/af72ae9ce826
Branch: default
Log Message:
merged with sep2022
diffs (62 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
@@ -15,7 +15,8 @@
str
OPTmitosisImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr
pci)
{
- int i, j, limit, slimit, estimate = 0, pieces = 1, mito_parts = 0,
mito_size = 0, row_size = 0, mt = -1;
+ int i, j, limit, slimit, estimate = 0, pieces = 1, mito_parts = 0,
mito_size = 0, row_size = 0, mt = -1, nr_cols = 0,
+ nr_aggrs = 0;
str schema = 0, table = 0;
BUN r = 0, rowcnt = 0; /* table should be sizeable to consider
parallel execution*/
InstrPtr p, q, *old, target = 0;
@@ -51,6 +52,8 @@ OPTmitosisImplementation(Client cntxt, M
if (p->retc == 2 && isMatJoinOp(p))
maxslices = threads;
+ nr_aggrs += (p->argc > 2 && getModuleId(p) == aggrRef);
+
if (p->argc > 2 && getModuleId(p) == aggrRef &&
getFunctionId(p) != subcountRef &&
getFunctionId(p) != subminRef &&
@@ -113,10 +116,13 @@ OPTmitosisImplementation(Client cntxt, M
* single subplan should ideally fit together.
*/
r = getRowCnt(mb, getArg(p, 0));
+ if (r == rowcnt)
+ nr_cols++;
if (r > rowcnt) {
/* the rowsize depends on the column types, assume
void-headed */
row_size = ATOMsize(getBatType(getArgType(mb,p,0)));
rowcnt = r;
+ nr_cols = 1;
target = p;
estimate++;
r = 0;
@@ -151,6 +157,9 @@ OPTmitosisImplementation(Client cntxt, M
if (cntxt->memorylimit == 0 || pieces <= 1){
*/
if (pieces <= 1){
+ /* improve memory usage estimation */
+ if (nr_cols > 1 || nr_aggrs > 1)
+ argsize = (nr_cols + nr_aggrs) * sizeof(lng);
/* We haven't assigned the number of pieces.
* Determine the memory available for this client
*/
@@ -181,11 +190,13 @@ OPTmitosisImplementation(Client cntxt, M
/* the number of pieces affects SF-100, going beyond 8x
increases
* the optimizer costs beyond the execution time
*/
- pieces = 4 * (int) ceil((double)rowcnt / m / threads);
+ pieces = ((int) ceil((double)rowcnt / m / threads));
+ if (pieces <= threads)
+ pieces = threads;
} else if (rowcnt > MINPARTCNT) {
/* exploit parallelism, but ensure minimal partition size to
* limit overhead */
- pieces = 4 * (int) ceil(MIN((double)rowcnt /
MINPARTCNT, threads));
+ pieces = MIN((int) ceil((double)rowcnt / MINPARTCNT),
threads);
}
}
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]