diff options
author | Monty <monty@mariadb.org> | 2014-08-29 14:07:43 +0300 |
---|---|---|
committer | Sergey Vojtovich <svoj@mariadb.org> | 2014-12-05 11:01:51 +0400 |
commit | 78564373fee5e6cccf144b11bc60b0876b4bbd0b (patch) | |
tree | b58780d298efdbceee041e5c07d030e500ec64cf /sql/sql_explain.h | |
parent | 3392278c869a9594f13a0b956d34efb600ab0ed0 (diff) | |
download | mariadb-git-78564373fee5e6cccf144b11bc60b0876b4bbd0b.tar.gz |
my_alloc.cmariadb-10.1.2
- Changed 0x%lx -> %p
array.c:
- Static (preallocated) buffer can now be anywhere
my_sys.h
- Define MY_INIT_BUFFER_USED
sql_delete.cc & sql_lex.cc
- Use memroot when allocating classes (avoids call to current_thd)
sql_explain.h:
- Use preallocated buffers
sql_explain.cc:
- Use preallocated buffers and memroot
sql_select.cc:
- Use multi_alloc_root() instead of many alloc_root()
- Update calls to Explain
Diffstat (limited to 'sql/sql_explain.h')
-rw-r--r-- | sql/sql_explain.h | 81 |
1 files changed, 45 insertions, 36 deletions
diff --git a/sql/sql_explain.h b/sql/sql_explain.h index 68ef59c732d..352be32bbcd 100644 --- a/sql/sql_explain.h +++ b/sql/sql_explain.h @@ -90,6 +90,9 @@ class Json_writer; class Explain_node : public Sql_alloc { public: + Explain_node(MEM_ROOT *root) + :children(root) + {} /* A type specifying what kind of node this is */ enum explain_node_type { @@ -158,20 +161,10 @@ class Explain_basic_join : public Explain_node public: enum explain_node_type get_type() { return EXPLAIN_BASIC_JOIN; } - Explain_basic_join() : join_tabs(NULL) {} + Explain_basic_join(MEM_ROOT *root) : Explain_node(root), join_tabs(NULL) {} ~Explain_basic_join(); - bool add_table(Explain_table_access *tab) - { - if (!join_tabs) - { - join_tabs= (Explain_table_access**) my_malloc(sizeof(Explain_table_access*) * - MAX_TABLES, MYF(0)); - n_join_tabs= 0; - } - join_tabs[n_join_tabs++]= tab; - return false; - } + bool add_table(Explain_table_access *tab, Explain_query *query); int get_select_id() { return select_id; } @@ -199,8 +192,8 @@ public: In the non-degenerate case, a SELECT may have a GROUP BY/ORDER BY operation. - In both cases, the select may have children nodes. class Explain_node provides - a way get node's children. + In both cases, the select may have children nodes. class Explain_node + provides a way get node's children. */ class Explain_select : public Explain_basic_join @@ -208,7 +201,8 @@ class Explain_select : public Explain_basic_join public: enum explain_node_type get_type() { return EXPLAIN_SELECT; } - Explain_select() : + Explain_select(MEM_ROOT *root) : + Explain_basic_join(root), message(NULL), using_temporary(false), using_filesort(false) {} @@ -255,6 +249,10 @@ private: class Explain_union : public Explain_node { public: + Explain_union(MEM_ROOT *root) : + Explain_node(root) + {} + enum explain_node_type get_type() { return EXPLAIN_UNION; } int get_select_id() @@ -348,7 +346,7 @@ class Explain_insert; class Explain_query : public Sql_alloc { public: - Explain_query(THD *thd); + Explain_query(THD *thd, MEM_ROOT *root); ~Explain_query(); /* Add a new node */ @@ -536,9 +534,10 @@ private: class Explain_table_access : public Sql_alloc { public: - Explain_table_access() : + Explain_table_access(MEM_ROOT *root) : derived_select_number(0), non_merged_sjm_number(0), + extra_tags(root), start_dups_weedout(false), end_dups_weedout(false), where_cond(NULL), @@ -551,9 +550,13 @@ public: void push_extra(enum explain_extra_tag extra_tag); /* Internals */ -public: + /* id and 'select_type' are cared-of by the parent Explain_select */ StringBuffer<32> table_name; + StringBuffer<32> used_partitions; + // valid with ET_USING_MRR + StringBuffer<32> mrr_type; + StringBuffer<32> firstmatch_table_name; /* Non-zero number means this is a derived table. The number can be used to @@ -565,11 +568,15 @@ public: enum join_type type; - StringBuffer<32> used_partitions; bool used_partitions_set; /* Empty means "NULL" will be printed */ String_list possible_keys; + + bool rows_set; /* not set means 'NULL' should be printed */ + bool filtered_set; /* not set means 'NULL' should be printed */ + // Valid if ET_USING_INDEX_FOR_GROUP_BY is present + bool loose_scan_is_scanning; /* Index use: key name and length. @@ -589,10 +596,7 @@ public: String_list ref_list; - bool rows_set; /* not set means 'NULL' should be printed */ ha_rows rows; - - bool filtered_set; /* not set means 'NULL' should be printed */ double filtered; /* @@ -604,19 +608,11 @@ public: // Valid if ET_USING tag is present Explain_quick_select *quick_info; - // Valid if ET_USING_INDEX_FOR_GROUP_BY is present - bool loose_scan_is_scanning; - // valid with ET_RANGE_CHECKED_FOR_EACH_RECORD key_map range_checked_map; - // valid with ET_USING_MRR - StringBuffer<32> mrr_type; - // valid with ET_USING_JOIN_BUFFER EXPLAIN_BKA_TYPE bka_type; - - StringBuffer<32> firstmatch_table_name; bool start_dups_weedout; bool end_dups_weedout; @@ -633,6 +629,12 @@ public: Explain_basic_join *sjm_nest; + /* ANALYZE members */ + + /* Tracker for reading the table */ + Table_access_tracker tracker; + Table_access_tracker jbuf_tracker; + int print_explain(select_result_sink *output, uint8 explain_flags, bool is_analyze, uint select_id, const char *select_type, @@ -640,12 +642,6 @@ public: void print_explain_json(Explain_query *query, Json_writer *writer, bool is_analyze); - /* ANALYZE members */ - - /* Tracker for reading the table */ - Table_access_tracker tracker; - Table_access_tracker jbuf_tracker; - private: void append_tag_name(String *str, enum explain_extra_tag tag); void fill_key_str(String *key_str, bool is_json) const; @@ -665,6 +661,11 @@ private: class Explain_update : public Explain_node { public: + + Explain_update(MEM_ROOT *root) : + Explain_node(root) + {} + virtual enum explain_node_type get_type() { return EXPLAIN_UPDATE; } virtual int get_select_id() { return 1; /* always root */ } @@ -719,6 +720,10 @@ public: class Explain_insert : public Explain_node { public: + Explain_insert(MEM_ROOT *root) : + Explain_node(root) + {} + StringBuffer<64> table_name; enum explain_node_type get_type() { return EXPLAIN_INSERT; } @@ -738,6 +743,10 @@ public: class Explain_delete: public Explain_update { public: + Explain_delete(MEM_ROOT *root) : + Explain_update(root) + {} + /* TRUE means we're going to call handler->delete_all_rows() and not read any rows. |