summaryrefslogtreecommitdiff
path: root/sql/opt_range.cc
diff options
context:
space:
mode:
authorunknown <gkodinov/kgeorge@macbook.gmz>2006-11-28 18:06:47 +0200
committerunknown <gkodinov/kgeorge@macbook.gmz>2006-11-28 18:06:47 +0200
commit762f4ac16715b13fffa24520513b947c5ccdf82c (patch)
tree5007db7fe150a171bbb523f88da6b7279bca7362 /sql/opt_range.cc
parent3ebdcee5c64f29e7a4d4876b25f1e7afe6b52a60 (diff)
downloadmariadb-git-762f4ac16715b13fffa24520513b947c5ccdf82c.tar.gz
Bug#24156: Loose index scan not used with CREATE TABLE ...SELECT and similar
statements Currently the optimizer evaluates loose index scan only for top-level SELECT statements Extend loose index scan applicability by : - Test the applicability of loose scan for each sub-select, instead of the whole query. This change enables loose index scan for sub-queries. - allow non-select statements with SELECT parts (like, e.g. CREATE TABLE .. SELECT ...) to use loose index scan. mysql-test/r/group_min_max.result: Bug#24156: Loose index scan not used with CREATE TABLE ...SELECT and similar statements - test case mysql-test/t/group_min_max.test: Bug#24156: Loose index scan not used with CREATE TABLE ...SELECT and similar statements - test case sql/opt_range.cc: Bug#24156: Loose index scan not used with CREATE TABLE ...SELECT and similar statements - loose index scan will be tried over the current subselect (lex->current_select) instead of the whole query (lex->select_lex). - allow non-select statements with SELECT parts (like, e.g. CREATE TABLE .. SELECT ...) to use loose index scan.
Diffstat (limited to 'sql/opt_range.cc')
-rw-r--r--sql/opt_range.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 96239315026..596640fdf95 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -7445,7 +7445,7 @@ static TRP_GROUP_MIN_MAX *
get_best_group_min_max(PARAM *param, SEL_TREE *tree)
{
THD *thd= param->thd;
- JOIN *join= thd->lex->select_lex.join;
+ JOIN *join= thd->lex->current_select->join;
TABLE *table= param->table;
bool have_min= FALSE; /* TRUE if there is a MIN function. */
bool have_max= FALSE; /* TRUE if there is a MAX function. */
@@ -7466,7 +7466,7 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree)
DBUG_ENTER("get_best_group_min_max");
/* Perform few 'cheap' tests whether this access method is applicable. */
- if (!join || (thd->lex->sql_command != SQLCOM_SELECT))
+ if (!join)
DBUG_RETURN(NULL); /* This is not a select statement. */
if ((join->tables != 1) || /* The query must reference one table. */
((!join->group_list) && /* Neither GROUP BY nor a DISTINCT query. */
@@ -8316,7 +8316,7 @@ TRP_GROUP_MIN_MAX::make_quick(PARAM *param, bool retrieve_full_rows,
DBUG_ENTER("TRP_GROUP_MIN_MAX::make_quick");
quick= new QUICK_GROUP_MIN_MAX_SELECT(param->table,
- param->thd->lex->select_lex.join,
+ param->thd->lex->current_select->join,
have_min, have_max, min_max_arg_part,
group_prefix_len, used_key_parts,
index_info, index, read_cost, records,