diff options
Diffstat (limited to 'sql/sql_explain.h')
-rw-r--r-- | sql/sql_explain.h | 46 |
1 files changed, 44 insertions, 2 deletions
diff --git a/sql/sql_explain.h b/sql/sql_explain.h index 97fe07572cf..ce3f3ef06e1 100644 --- a/sql/sql_explain.h +++ b/sql/sql_explain.h @@ -331,6 +331,8 @@ public: ///////////////////////////////////////////////////////////////////////////// extern const char *unit_operation_text[4]; +extern const char *pushed_derived_text; +extern const char *pushed_select_text; /* Explain structure for a UNION. @@ -586,6 +588,8 @@ class Explain_index_use : public Sql_alloc { char *key_name; uint key_len; + char *filter_name; + uint filter_len; public: String_list key_parts_list; @@ -598,12 +602,46 @@ public: { key_name= NULL; key_len= (uint)-1; + filter_name= NULL; + filter_len= (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); inline const char *get_key_name() const { return key_name; } inline uint get_key_len() const { return key_len; } + //inline const char *get_filter_name() const { return filter_name; } +}; + + +/* + Query Plan data structure for Rowid filter. +*/ +class Explain_rowid_filter : public Sql_alloc +{ +public: + /* Quick select used to collect the rowids into filter */ + Explain_quick_select *quick; + + /* How many rows the above quick select is expected to return */ + ha_rows rows; + + /* Expected selectivity for the filter */ + double selectivity; + + /* Tracker with the information about how rowid filter is executed */ + Rowid_filter_tracker *tracker; + + void print_explain_json(Explain_query *query, Json_writer *writer, + bool is_analyze); + + /* + TODO: + Here should be ANALYZE members: + - r_rows for the quick select + - An object that tracked the table access time + - real selectivity of the filter. + */ }; @@ -673,6 +711,7 @@ public: void print_json(Json_writer *writer, bool is_analyze); }; + /* EXPLAIN data structure for a single JOIN_TAB. */ @@ -692,7 +731,8 @@ public: cache_cond(NULL), pushed_index_cond(NULL), sjm_nest(NULL), - pre_join_sort(NULL) + pre_join_sort(NULL), + rowid_filter(NULL) {} ~Explain_table_access() { delete sjm_nest; } @@ -799,6 +839,8 @@ public: Exec_time_tracker op_tracker; Table_access_tracker jbuf_tracker; + Explain_rowid_filter *rowid_filter; + int print_explain(select_result_sink *output, uint8 explain_flags, bool is_analyze, uint select_id, const char *select_type, @@ -809,7 +851,7 @@ public: private: void append_tag_name(String *str, enum explain_extra_tag tag); void fill_key_str(String *key_str, bool is_json) const; - void fill_key_len_str(String *key_len_str) const; + void fill_key_len_str(String *key_len_str, bool is_json) const; double get_r_filtered(); void tag_to_json(Json_writer *writer, enum explain_extra_tag tag); }; |