MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / final_table_drived

Function final_table_drived

sqladvisor/main.cc:329–356  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

327}
328
329void final_table_drived() {
330 if (options.verbose)
331 sql_print_information("第%d步:开始选择驱动表,一共有%d个候选驱动表 \n", STEP_CNT++,
332 TABLE_DRIVERD.size());
333 int small_result_set = numeric_limits<int>::max();
334 if (!TABLE_DRIVERD.empty()) {
335 set<TABLE_LIST *>::iterator drived_it;
336 for (drived_it = TABLE_DRIVERD.begin();
337 drived_it != TABLE_DRIVERD.end(); drived_it++) {
338 int result_set = get_join_table_result_set(*drived_it);
339 if (options.verbose)
340 sql_print_information("第%d步:候选驱动表%s的结果集行数为:%d \n", STEP_CNT++,
341 (*drived_it)->table_name, result_set);
342 if (result_set < small_result_set) {
343 DRIVED_TABLE = *drived_it;
344 small_result_set = result_set;
345 }
346 }
347 if (DRIVED_TABLE != NULL) {
348 DRIVED_TABLE->is_table_driverd = true;
349 if (options.verbose)
350 sql_print_information("第%d步:选择表%s为驱动表 \n", STEP_CNT++,DRIVED_TABLE->table_name);
351 } else {
352 sql_print_information("第%d步:侯选驱动表个数:%d,但无法确定驱动表 \n", STEP_CNT++,TABLE_DRIVERD.size());
353 exit(-1);
354 }
355 }
356}
357
358void table_index_add_condition_field() {
359 set<TABLE_LIST *> deployed_table_set;

Callers 1

mysql_sql_parse_adminFunction · 0.85

Calls 6

sql_print_informationFunction · 0.85
sizeMethod · 0.45
emptyMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected