diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2019-05-21 15:45:52 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2019-05-21 15:45:52 +0300 |
commit | b90918dae33f8e3be4af2915984b5a4587e69f89 (patch) | |
tree | 21e9d66d4da48ebef7fa9b10dd9ddb72a37b5cbf | |
parent | 3a871c39a97c8029ec0f8a424a2ea5c2ac557d24 (diff) | |
parent | 91efcc6392cef920aa3697dc9789830ae9cdd379 (diff) | |
download | mariadb-git-b90918dae33f8e3be4af2915984b5a4587e69f89.tar.gz |
Merge 10.1 into 10.2
-rw-r--r-- | sql/sql_select.cc | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 4dadff9d98a..614af3ee73c 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -10176,8 +10176,16 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond) /* We plan to scan all rows. Check again if we should use an index. - We could have used an column from a previous table in - the index if we are using limit and this is the first table + + There are two cases: + 1) There could be an index usage the refers to a previous + table that we didn't consider before, but could be consider + now as a "last resort". For example + SELECT * from t1,t2 where t1.a between t2.a and t2.b; + 2) If the current table is the first non const table + and there is a limit it still possibly beneficial + to use the index even if the index range is big as + we can stop when we've found limit rows. (1) - Don't switch the used index if we are using semi-join LooseScan on this table. Using different index will not |