diff options
author | Sergey Petrunya <psergey@askmonty.org> | 2013-06-20 22:30:30 +0400 |
---|---|---|
committer | Sergey Petrunya <psergey@askmonty.org> | 2013-06-20 22:30:30 +0400 |
commit | ab4a13b2b91e260d8c75a3c41b7ff5c24747cee0 (patch) | |
tree | 39626d12d01af8959bcdd846e4c5edd5f92667c2 /sql/sql_lex.cc | |
parent | 52cfa54c1d211a17a9df7c38a4568ddc4d09e6d9 (diff) | |
download | mariadb-git-ab4a13b2b91e260d8c75a3c41b7ff5c24747cee0.tar.gz |
Switching [EXPLAIN] UPDATE/DELETE to rely on query plan footprints.
This requires that subselect's footprints are saved before it is deleted.
Attempt to save select's QPF exposes one to a variety of edge cases:
- the select may be a UNION's "fake select" which has no valid id
- optimization may fail in the middle (but subsequent JOIN::optimize() calls
will succeed, despite the fact that there never was a query plan)
Diffstat (limited to 'sql/sql_lex.cc')
-rw-r--r-- | sql/sql_lex.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 455ef55944d..3161dc85fb9 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -4341,7 +4341,8 @@ int st_select_lex_unit::save_qpf(QPF_query *output) if (!first->next_select()) { /* This is a 1-way UNION, i.e. not really a UNION */ - first->save_qpf(output); + if (!output->get_select(first->select_number)) + first->save_qpf(output); return 0; } @@ -4371,7 +4372,8 @@ int st_select_lex_unit::save_qpf(QPF_query *output) for (SELECT_LEX *sl= first; sl; sl= sl->next_select()) { - sl->save_qpf(output); + if (!output->get_select(sl->select_number)) + sl->save_qpf(output); qpfu->add_select(sl->select_number); } |