1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

feat(optimizer): add session switch to optionally enable optimizer

This commit is contained in:
drrtuy
2025-06-16 13:26:11 +00:00
parent ab6063bec4
commit 25c7d23c21
4 changed files with 67 additions and 39 deletions

View File

@ -9197,11 +9197,12 @@ int cs_get_derived_plan(ha_columnstore_derived_handler* handler, THD* /*thd*/, S
else if (status < 0)
return status;
#ifdef DEBUG_WALK_COND
cerr << "---------------- cs_get_derived_plan EXECUTION PLAN ----------------" << endl;
cerr << *csep << endl;
cerr << "-------------- EXECUTION PLAN END --------------\n" << endl;
#endif
if (csep->traceOn())
{
cerr << "---------------- cs_get_derived_plan EXECUTION PLAN ----------------" << endl;
cerr << *csep << endl;
cerr << "-------------- EXECUTION PLAN END --------------\n" << endl;
}
// Derived table projection and filter optimization.
derivedTableOptimization(&gwi, csep);
return 0;
@ -9230,25 +9231,24 @@ int cs_get_select_plan(ha_columnstore_select_handler* handler, THD* /*thd*/, SCS
else if (status < 0)
return status;
// #ifdef DEBUG_WALK_COND
cerr << "---------------- cs_get_select_plan EXECUTION PLAN ----------------" << endl;
cerr << *csep << endl;
cerr << "-------------- EXECUTION PLAN END --------------\n" << endl;
// #endif
if (csep->traceOn())
{
cerr << "---------------- cs_get_select_plan EXECUTION PLAN ----------------" << endl;
cerr << *csep << endl;
cerr << "-------------- EXECUTION PLAN END --------------\n" << endl;
}
// Derived table projection and filter optimization.
derivedTableOptimization(&gwi, csep);
optimizer::Rule parallelCES{"parallelCES", optimizer::matchParallelCES, optimizer::applyParallelCES};
bool csepWasOptimized = optimizer::optimizeCSEP(*csep);
if (csep->traceOn() && csepWasOptimized)
{
parallelCES.apply(*csep);
cerr << "---------------- cs_get_select_plan optimized EXECUTION PLAN ----------------" << endl;
cerr << *csep << endl;
cerr << "-------------- EXECUTION PLAN END --------------\n" << endl;
}
cerr << "---------------- cs_get_select_plan rewritten EXECUTION PLAN ----------------" << endl;
cerr << *csep << endl;
cerr << "-------------- EXECUTION PLAN END --------------\n" << endl;
return 0;
}