summaryrefslogtreecommitdiff
path: root/sql/table.cc
diff options
context:
space:
mode:
authorAndrei Elkin <andrei.elkin@mariadb.com>2019-11-11 16:03:43 +0200
committerAndrei Elkin <andrei.elkin@mariadb.com>2019-11-11 16:03:43 +0200
commit26fd880d5eba5e46e69f88f21cc6ca45cbda0a4f (patch)
treea02a4bb6992f540cd229776680d381c730d2ea77 /sql/table.cc
parent142442d571dd86c630019ece82e36dc73e1e5f1b (diff)
parent13db50fc03e7312e6c01b06c7e4af69f69ba5382 (diff)
downloadmariadb-git-26fd880d5eba5e46e69f88f21cc6ca45cbda0a4f.tar.gz
manual merge 10.1->10.2
Diffstat (limited to 'sql/table.cc')
-rw-r--r--sql/table.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/sql/table.cc b/sql/table.cc
index 57abf6c4c7b..bb6c35fecd2 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -4571,6 +4571,8 @@ void TABLE::init(THD *thd, TABLE_LIST *tl)
created= TRUE;
cond_selectivity= 1.0;
cond_selectivity_sampling_explain= NULL;
+ quick_condition_rows=0;
+ initialize_quick_structures();
#ifdef HAVE_REPLICATION
/* used in RBR Triggers */
master_had_triggers= 0;
@@ -8556,3 +8558,22 @@ bool fk_modifies_child(enum_fk_option opt)
static bool can_write[]= { false, false, true, true, false, true };
return can_write[opt];
}
+
+
+/*
+ @brief
+ Initialize all the quick structures that are used to stored the
+ estimates when the range optimizer is run.
+ @details
+ This is specifically needed when we read the TABLE structure from the
+ table cache. There can be some garbage data from previous queries
+ that need to be reset here.
+*/
+
+void TABLE::initialize_quick_structures()
+{
+ bzero(quick_rows, sizeof(quick_rows));
+ bzero(quick_key_parts, sizeof(quick_key_parts));
+ bzero(quick_costs, sizeof(quick_costs));
+ bzero(quick_n_ranges, sizeof(quick_n_ranges));
+}