diff options
author | Varun Gupta <varun.gupta@mariadb.com> | 2019-11-07 15:24:21 +0530 |
---|---|---|
committer | Varun Gupta <varun.gupta@mariadb.com> | 2019-11-07 15:24:21 +0530 |
commit | b1ab2ba5833ad466ea9c08b89d89bb51e1d445ed (patch) | |
tree | bf024e62fdb3d3c2ba07f3a5f311a858cb2084fb /sql/table.h | |
parent | 4e99e67c4e8a04bd03cb0e7efc2ce0129af60c34 (diff) | |
download | mariadb-git-b1ab2ba5833ad466ea9c08b89d89bb51e1d445ed.tar.gz |
MDEV-20519: Query plan regression with optimizer_use_condition_selectivity > 1
The issue here is the wrong estimate of the cardinality of a partial join,
the cardinality is too high because the function table_cond_selectivity()
returns an absurd number 100 while selectivity cannot be greater than 1.
When accessing table t by outer reference t1.a via index we do not perform any
range analysis for t. Yet we see TABLE::quick_key_parts[key] and
TABLE->quick_rows[key] contain a non-zero value though these should have been
remained untouched and equal to 0.
Thus real cause of the problem is that TABLE::init does not clean the arrays
TABLE::quick_key_parts[] and TABLE::>quick_rows[].
It should have done it because the TABLE structure created for any
instance of a table can be reused for many queries.
Diffstat (limited to 'sql/table.h')
-rw-r--r-- | sql/table.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/sql/table.h b/sql/table.h index 98ec9f005ea..44803b5aacd 100644 --- a/sql/table.h +++ b/sql/table.h @@ -1450,6 +1450,7 @@ public: } bool update_const_key_parts(COND *conds); + void initialize_quick_structures(); my_ptrdiff_t default_values_offset() const { return (my_ptrdiff_t) (s->default_values - record[0]); } |