diff options
| author | Sergei Petrunia <psergey@askmonty.org> | 2014-11-27 23:10:44 +0300 |
|---|---|---|
| committer | Sergei Petrunia <psergey@askmonty.org> | 2014-11-27 23:10:44 +0300 |
| commit | 461dbd80d2ea96034f330dd238282d2167ed2c4d (patch) | |
| tree | 814c5063aeecce0af411b9bc2d85df520bd62f15 /sql/sql_explain.cc | |
| parent | 37c444e1a079b25d0a34efbbc2fadfae17999966 (diff) | |
| download | mariadb-git-461dbd80d2ea96034f330dd238282d2167ed2c4d.tar.gz | |
EXPLAIN FORMAT=JSON: support join buffering
- Basic support for JOIN buffering
- The output is not polished but catches the main point:
tab->select_cond and tab->cache_select->cond are printed separately.
- Hash join support is poor still.
- Also fixed identation in JOIN_TAB::save_explain_data
Diffstat (limited to 'sql/sql_explain.cc')
| -rw-r--r-- | sql/sql_explain.cc | 39 |
1 files changed, 35 insertions, 4 deletions
diff --git a/sql/sql_explain.cc b/sql/sql_explain.cc index 2e60c65aa2e..a37d324180f 100644 --- a/sql/sql_explain.cc +++ b/sql/sql_explain.cc @@ -903,8 +903,18 @@ void Explain_table_access::tag_to_json(Json_writer *writer, enum explain_extra_t write_item(writer, pushed_index_cond); break; case ET_USING_WHERE: - writer->add_member("attached_condition"); - write_item(writer, where_cond); + if (where_cond) + { + writer->add_member("attached_condition"); + /* + We are printing the condition that is checked when scanning this + table. + - when join buffer is used, it is cache_cond. + - in other cases, it is where_cond. + */ + Item *item= bka_type.is_using_jbuf()? cache_cond: where_cond; + write_item(writer, item); + } break; case ET_USING_INDEX: writer->add_member("using_index").add_bool(true); @@ -912,8 +922,8 @@ void Explain_table_access::tag_to_json(Json_writer *writer, enum explain_extra_t case ET_USING: // index merge: case ET_USING break; - case ET_USING_JOIN_BUFFER: - // TODO TODO + case ET_USING_JOIN_BUFFER: + /* Do nothing. Join buffer is handled differently */ break; default: DBUG_ASSERT(0); @@ -925,6 +935,12 @@ void Explain_table_access::print_explain_json(Json_writer *writer, bool is_analyze) { Json_writer_nesting_guard guard(writer); + + if (bka_type.is_using_jbuf()) + { + writer->add_member("block-nl-join").start_object(); + } + writer->add_member("table").start_object(); writer->add_member("table_name").add_str(table_name); @@ -1018,6 +1034,21 @@ void Explain_table_access::print_explain_json(Json_writer *writer, tag_to_json(writer, extra_tags.at(i)); } + if (bka_type.is_using_jbuf()) + { + writer->end_object(); + writer->add_member("buffer_type").add_str(bka_type.incremental? + "incremental":"flat"); + writer->add_member("join_type").add_str(bka_type.join_alg); + if (bka_type.mrr_type.length()) + writer->add_member("mrr_type").add_str(bka_type.mrr_type); + if (where_cond) + { + writer->add_member("attached_condition"); + write_item(writer, where_cond); + } + } + writer->end_object(); } |
