summaryrefslogtreecommitdiff
path: root/sql/opt_subselect.cc
diff options
context:
space:
mode:
authorunknown <knielsen@knielsen-hq.org>2012-03-21 09:55:48 +0100
committerunknown <knielsen@knielsen-hq.org>2012-03-21 09:55:48 +0100
commit07de9ab7fcfcc004eb30d8b5254a5981af3cf5ab (patch)
tree7da562f5b0a32d8c6e3e347c66ea0682732dbfe5 /sql/opt_subselect.cc
parent9a04194428324a446b2662a160e89aa663549dfb (diff)
downloadmariadb-git-07de9ab7fcfcc004eb30d8b5254a5981af3cf5ab.tar.gz
Few simple performance fixes found with sysbench oltp.lua and Oprofile:
- Avoid needless load/stores in my_hash_sort_simple due to possible aliasing - Avoid expensive Join_plan_state constructor in choose_subquery_plan when no subquery - Avoid calling update_virtual_fields for every row when no virtual fields.
Diffstat (limited to 'sql/opt_subselect.cc')
-rw-r--r--sql/opt_subselect.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc
index dcb5181acc3..1f6524e5afa 100644
--- a/sql/opt_subselect.cc
+++ b/sql/opt_subselect.cc
@@ -4950,7 +4950,6 @@ bool setup_jtbm_semi_joins(JOIN *join, List<TABLE_LIST> *join_list,
bool JOIN::choose_subquery_plan(table_map join_tables)
{
- Join_plan_state save_qep; /* The original QEP of the subquery. */
enum_reopt_result reopt_result= REOPT_NONE;
Item_in_subselect *in_subs;
@@ -4969,12 +4968,15 @@ bool JOIN::choose_subquery_plan(table_map join_tables)
}
else
return false;
+
/* A strategy must be chosen earlier. */
DBUG_ASSERT(in_subs->has_strategy());
DBUG_ASSERT(in_to_exists_where || in_to_exists_having);
DBUG_ASSERT(!in_to_exists_where || in_to_exists_where->fixed);
DBUG_ASSERT(!in_to_exists_having || in_to_exists_having->fixed);
+ Join_plan_state save_qep; /* The original QEP of the subquery. */
+
/*
Compute and compare the costs of materialization and in-exists if both
strategies are possible and allowed by the user (checked during the prepare