mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-34041 Display additional information for materialized subqueries in EXPLAIN/ANALYZE FORMAT=JSON
This commits adds the "materialization" block to the output of EXPLAIN/ANALYZE FORMAT=JSON when materialized subqueries are involved into processing. In the case of ANALYZE additional runtime information is displayed, such as: - chosen strategy of materialization - number of partial match/index lookup loops - sizes of partial match buffers
This commit is contained in:
@ -86,6 +86,7 @@ class Explain_node : public Sql_alloc
|
||||
public:
|
||||
Explain_node(MEM_ROOT *root) :
|
||||
cache_tracker(NULL),
|
||||
subq_materialization(NULL),
|
||||
connection_type(EXPLAIN_NODE_OTHER),
|
||||
children(root)
|
||||
{}
|
||||
@ -115,6 +116,12 @@ public:
|
||||
*/
|
||||
Expression_cache_tracker* cache_tracker;
|
||||
|
||||
/**
|
||||
If not NULL, this node is a SELECT (or UNION) in a materialized
|
||||
IN-subquery.
|
||||
*/
|
||||
Explain_subq_materialization* subq_materialization;
|
||||
|
||||
/*
|
||||
How this node is connected to its parent.
|
||||
(NOTE: EXPLAIN_NODE_NON_MERGED_SJ is set very late currently)
|
||||
@ -143,6 +150,8 @@ public:
|
||||
void print_explain_json_for_children(Explain_query *query,
|
||||
Json_writer *writer, bool is_analyze);
|
||||
bool print_explain_json_cache(Json_writer *writer, bool is_analyze);
|
||||
bool print_explain_json_subq_materialization(Json_writer *writer,
|
||||
bool is_analyze);
|
||||
virtual ~Explain_node() = default;
|
||||
};
|
||||
|
||||
@ -1003,4 +1012,26 @@ public:
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
EXPLAIN data structure for subquery materialization.
|
||||
|
||||
All decisions are made at execution time so here we just store the tracker
|
||||
that has all the info.
|
||||
*/
|
||||
|
||||
class Explain_subq_materialization : public Sql_alloc
|
||||
{
|
||||
public:
|
||||
Explain_subq_materialization(MEM_ROOT *mem_root)
|
||||
: tracker(mem_root)
|
||||
{}
|
||||
|
||||
Subq_materialization_tracker *get_tracker() { return &tracker; }
|
||||
|
||||
void print_explain_json(Json_writer *writer, bool is_analyze);
|
||||
|
||||
private:
|
||||
Subq_materialization_tracker tracker;
|
||||
};
|
||||
|
||||
#endif //SQL_EXPLAIN_INCLUDED
|
||||
|
Reference in New Issue
Block a user