mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-34894: Poor query plan, because range estimates are not reused for ref(const)
(Variant 4, with @@optimizer_adjust_secondary_key_costs, reuse in two places, and conditions are replaced with equivalent simpler forms in two more) In best_access_path(), ReuseRangeEstimateForRef-3, the check for whether "all used key_part_i used key_part_i=const" was incorrect: it may produced a "NO" answer for cases when we had: key_part1= const // some key parts are usable key_part2= value_not_in_join_prefix //present but unusable key_part3= non_const_value // unusable due to gap in key parts. This caused the optimizer to fail to apply ReuseRangeEstimateForRef heuristics. The consequence is poor query plan choice when the index in question has very skewed data distribution. The fix is enabled if its @@optimizer_adjust_secondary_key_costs flag is set.
This commit is contained in:
@@ -275,6 +275,7 @@
|
||||
#define OPTIMIZER_ADJ_DISABLE_MAX_SEEKS (2)
|
||||
#define OPTIMIZER_ADJ_DISABLE_FORCE_INDEX_GROUP_BY (4)
|
||||
#define OPTIMIZER_FIX_INNODB_CARDINALITY (8)
|
||||
#define OPTIMIZER_ADJ_FIX_REUSE_RANGE_FOR_REF (16)
|
||||
|
||||
/*
|
||||
Replication uses 8 bytes to store SQL_MODE in the binary log. The day you
|
||||
|
Reference in New Issue
Block a user