今天在深入學習MySQL查詢優化器的過程中,發現一個低級的錯誤,應該是開發人員出於筆誤導致的,當然這個錯誤不會出現問題,僅僅會在debug環境下,輸出trace信息的時候會誤導開發人員。
本文基於mysql-5.5.20源代碼進行調試開發。
點擊(此處)摺疊或打開
-
DBUG_EXECUTE("opt", print_plan(join, idx, read_time, record_count, idx,
- "SOFAR:"););
點擊(此處)摺疊或打開
-
/*
-
print_plan()
-
join pointer to the structure providing all context info for
-
the query
-
read_time the cost of the best partial plan
-
record_count estimate for the number of records returned by the best
-
partial plan
-
idx length of the partial QEP in 'join->positions';
-
also an index in the array 'join->best_ref';
-
info comment string to appear above the printout
-
*/
-
void
-
print_plan(JOIN* join, uint
idx, double record_count, double read_time,
- double current_read_time, const char *info)
點擊(此處)摺疊或打開
-
DBUG_EXECUTE("opt", print_plan(join, idx, record_count, read_time, idx,
- "SOFAR:"););