summaryrefslogtreecommitdiff
path: root/sql/item_subselect.h
diff options
context:
space:
mode:
authorunknown <timour@askmonty.org>2012-10-25 15:50:10 +0300
committerunknown <timour@askmonty.org>2012-10-25 15:50:10 +0300
commit97a1c53c8141d473b87dc8048c19868e8531db9e (patch)
tree2f37d05240ae6a31eb059d88a3886944b64d4d5a /sql/item_subselect.h
parent797082ca712f52437571e24962e26573d0723ad1 (diff)
downloadmariadb-git-97a1c53c8141d473b87dc8048c19868e8531db9e.tar.gz
MDEV-3812: Remove unneeded extra call to engine->exec() in Item_subselect::exec, remove enum store_key_result
This task fixes an ineffeciency that is a remainder from MySQL 5.0/5.1. There, subqueries were optimized in a lazy manner, when executed for the first time. During this lazy optimization it may happen that the server finds a more efficient subquery engine, and substitute the current engine of the query being executed with the new engine. This required re-execution of the engine. MariaDB 5.3 pre-optimizes subqueries in almost all cases, and the engine is chosen in most cases, except when subquery materialization found that it must use partial matching. In this case, the current code was performing one extra re-execution although it was not needed at all. The patch performs the re-execution only if the engine was changed while executing. In addition the patch performs small cleanup by removing "enum store_key_result" because it is essentially a boolean, and the code that uses it already maps it to a boolean.
Diffstat (limited to 'sql/item_subselect.h')
-rw-r--r--sql/item_subselect.h5
1 files changed, 1 insertions, 4 deletions
diff --git a/sql/item_subselect.h b/sql/item_subselect.h
index 2a64c63a1be..1da129380e7 100644
--- a/sql/item_subselect.h
+++ b/sql/item_subselect.h
@@ -122,8 +122,6 @@ public:
*/
bool eliminated;
- /* changed engine indicator */
- bool engine_changed;
/* subquery is transformed */
bool changed;
@@ -200,9 +198,9 @@ public:
{
old_engine= engine;
engine= eng;
- engine_changed= 1;
return eng == 0;
}
+ bool engine_changed(subselect_engine *eng) { return engine != eng; }
/*
True if this subquery has been already evaluated. Implemented only for
single select and union subqueries only.
@@ -260,7 +258,6 @@ public:
st_select_lex*, st_select_lex*,
Field*, Item*, Item_ident*);
friend bool convert_join_subqueries_to_semijoins(JOIN *join);
-
};
/* single value subselect */