Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDEV-31479: Inconsistency between MRR and SQL layer costs can cause p…
…oor query plan (Same as TODO-3938: best_access_path shows negative costs for mrr=on) best_access_path() assumes that quick select cost includes (quick->rows/TIME_FOR_COMPARE) as a cost of checking the attached part of the WHERE condition. It calls adjust_quick_cost() to subtract addition from quick's cost. The problem was that DS-MRR cost formula didn't include this cost. For very large tables, adjust_quick_cost() would produce a negative cost which would cause assert in debug build or bad query plan choice in release builds. Approved-by: Monty <[email protected]>
- Loading branch information