mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 03:52:35 +01:00
Trivial fix: Make test_if_cheaper_ordering() use actual_rec_per_key()
Discovered this while working on MDEV-34720: test_if_cheaper_ordering() uses rec_per_key, while the original estimate for the access method is produced in best_access_path() by using actual_rec_per_key(). Make test_if_cheaper_ordering() also use actual_rec_per_key(). Also make several getter function "const" to make this compile. Also adjusted the testcase to handle this (the change backported from 11.0)
This commit is contained in:
parent
9db2b327d4
commit
9020baf126
6 changed files with 8 additions and 4 deletions
|
@ -554,6 +554,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||
#
|
||||
# MDEV-6081: ORDER BY+ref(const): selectivity is very incorrect (MySQL Bug#14338686)
|
||||
#
|
||||
insert into t2 select seq,seq,seq from seq_10000_to_11000;
|
||||
alter table t2 add key2 int;
|
||||
update t2 set key2=key1;
|
||||
alter table t2 add key(key2);
|
||||
|
|
|
@ -558,7 +558,9 @@ from
|
|||
--echo #
|
||||
--echo # MDEV-6081: ORDER BY+ref(const): selectivity is very incorrect (MySQL Bug#14338686)
|
||||
--echo #
|
||||
--source include/have_sequence.inc
|
||||
|
||||
insert into t2 select seq,seq,seq from seq_10000_to_11000;
|
||||
alter table t2 add key2 int;
|
||||
update t2 set key2=key1;
|
||||
alter table t2 add key(key2);
|
||||
|
|
|
@ -30391,7 +30391,8 @@ test_if_cheaper_ordering(const JOIN_TAB *tab, ORDER *order, TABLE *table,
|
|||
else
|
||||
{
|
||||
const KEY *ref_keyinfo= table->key_info + ref_key;
|
||||
refkey_rows_estimate= ref_keyinfo->rec_per_key[tab->ref.key_parts - 1];
|
||||
refkey_rows_estimate=
|
||||
(ha_rows)ref_keyinfo->actual_rec_per_key(tab->ref.key_parts - 1);
|
||||
}
|
||||
set_if_bigger(refkey_rows_estimate, 1);
|
||||
}
|
||||
|
|
|
@ -472,7 +472,7 @@ public:
|
|||
|
||||
bool avg_frequency_is_inited() { return avg_frequency != NULL; }
|
||||
|
||||
double get_avg_frequency(uint i)
|
||||
double get_avg_frequency(uint i) const
|
||||
{
|
||||
return (double) avg_frequency[i] / Scale_factor_avg_frequency;
|
||||
}
|
||||
|
|
|
@ -166,7 +166,7 @@ typedef struct st_key {
|
|||
engine_option_value *option_list;
|
||||
ha_index_option_struct *option_struct; /* structure with parsed options */
|
||||
|
||||
double actual_rec_per_key(uint i);
|
||||
double actual_rec_per_key(uint i) const;
|
||||
|
||||
bool without_overlaps;
|
||||
/*
|
||||
|
|
|
@ -10034,7 +10034,7 @@ uint TABLE_SHARE::actual_n_key_parts(THD *thd)
|
|||
}
|
||||
|
||||
|
||||
double KEY::actual_rec_per_key(uint i)
|
||||
double KEY::actual_rec_per_key(uint i) const
|
||||
{
|
||||
if (rec_per_key == 0)
|
||||
return 0;
|
||||
|
|
Loading…
Reference in a new issue