diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2019-09-23 08:26:08 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2019-09-23 08:26:08 +0300 |
commit | 44c5144943f534b9dcd8ac771955127c7e1c2146 (patch) | |
tree | 3aab34b221a165f50758cc7d8c0f21f49d57c4ee /sql | |
parent | 1ad79c818780aafe1aaf1c25bbf975eb31a38a40 (diff) | |
parent | 896974fc3d721aabe1afbf637a566cab856a731d (diff) | |
download | mariadb-git-44c5144943f534b9dcd8ac771955127c7e1c2146.tar.gz |
Merge 10.1 into 10.2
Diffstat (limited to 'sql')
-rw-r--r-- | sql/opt_range.cc | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 5cdcb3159a1..99508cf0b50 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -2408,12 +2408,16 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use, records= head->stat_records(); if (!records) records++; /* purecov: inspected */ - scan_time= (double) records / TIME_FOR_COMPARE + 1; - read_time= (double) head->file->scan_time() + scan_time + 1.1; - if (head->force_index) + + if (head->force_index || force_quick_range) scan_time= read_time= DBL_MAX; - if (limit < records) - read_time= (double) records + scan_time + 1; // Force to use index + else + { + scan_time= (double) records / TIME_FOR_COMPARE + 1; + read_time= (double) head->file->scan_time() + scan_time + 1.1; + if (limit < records) + read_time= (double) records + scan_time + 1; // Force to use index + } possible_keys.clear_all(); |