summaryrefslogtreecommitdiff
path: root/sql/sql_explain.h
diff options
context:
space:
mode:
authorGalina Shalygina <galina.shalygina@mariadb.com>2018-08-16 00:24:52 +0300
committerGalina Shalygina <galina.shalygina@mariadb.com>2018-09-28 23:50:22 +0300
commit8d5a11122c32f4d9eb87536886c6e893377bdd07 (patch)
treeab8cc222d336acd0006a544abb362affc149f671 /sql/sql_explain.h
parentbefc09f00263d5375b2bb2ea0fac70b6cb0cb7fd (diff)
downloadmariadb-git-8d5a11122c32f4d9eb87536886c6e893377bdd07.tar.gz
MDEV-16188: Use in-memory PK filters built from range index scans
First phase: make optimizer choose to use filter and show it in EXPLAIN.
Diffstat (limited to 'sql/sql_explain.h')
-rw-r--r--sql/sql_explain.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/sql/sql_explain.h b/sql/sql_explain.h
index 38250cc40ce..71f90477977 100644
--- a/sql/sql_explain.h
+++ b/sql/sql_explain.h
@@ -583,6 +583,7 @@ class Explain_index_use : public Sql_alloc
{
char *key_name;
uint key_len;
+ uint key_len_for_filter;
public:
String_list key_parts_list;
@@ -595,12 +596,16 @@ public:
{
key_name= NULL;
key_len= (uint)-1;
+ key_len_for_filter= (uint)-1;
}
bool set(MEM_ROOT *root, KEY *key_name, uint key_len_arg);
bool set_pseudo_key(MEM_ROOT *root, const char *key_name);
+ void set_filter_key_length(uint key_length_arg)
+ { key_len_for_filter= key_length_arg; }
inline const char *get_key_name() const { return key_name; }
inline uint get_key_len() const { return key_len; }
+ inline uint get_filter_key_length() const { return key_len_for_filter; }
};
@@ -689,7 +694,8 @@ public:
cache_cond(NULL),
pushed_index_cond(NULL),
sjm_nest(NULL),
- pre_join_sort(NULL)
+ pre_join_sort(NULL),
+ filter_perc(UINT_MAX)
{}
~Explain_table_access() { delete sjm_nest; }
@@ -796,6 +802,13 @@ public:
Exec_time_tracker op_tracker;
Table_access_tracker jbuf_tracker;
+ /**
+ How many rows are left after the filter was applied
+ to the initial rows count in percentages.
+ */
+ double filter_perc;
+ inline bool is_filter_set() const { return (filter_perc != UINT_MAX); }
+
int print_explain(select_result_sink *output, uint8 explain_flags,
bool is_analyze,
uint select_id, const char *select_type,