summaryrefslogtreecommitdiff
path: root/sql/sql_explain.h
diff options
context:
space:
mode:
authorSergei Petrunia <psergey@askmonty.org>2014-08-14 01:12:05 +0400
committerSergei Petrunia <psergey@askmonty.org>2014-08-14 01:12:05 +0400
commit041e03e251e783d51ca86e53112e3b87bd2da146 (patch)
tree8df2309ea02720724bff15e5af86903e4bb95dd4 /sql/sql_explain.h
parenta9d43d70f5d83ac652fd970f5b2b8dfdb77c1136 (diff)
downloadmariadb-git-041e03e251e783d51ca86e53112e3b87bd2da146.tar.gz
EXPLAIN FORMAT=JSON: produce used_key_parts, JSON-ish output for index_merge.
Diffstat (limited to 'sql/sql_explain.h')
-rw-r--r--sql/sql_explain.h49
1 files changed, 28 insertions, 21 deletions
diff --git a/sql/sql_explain.h b/sql/sql_explain.h
index 26aa5753900..2500b3d3c05 100644
--- a/sql/sql_explain.h
+++ b/sql/sql_explain.h
@@ -14,6 +14,15 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+class String_list: public List<char>
+{
+public:
+ bool append_str(MEM_ROOT *mem_root, const char *str);
+};
+
+
+
/* Data structures for ANALYZE */
class Table_access_tracker
{
@@ -417,21 +426,16 @@ class Explain_index_use : public Sql_alloc
{
char *key_name;
uint key_len;
- /* will add #keyparts here if we implement EXPLAIN FORMAT=JSON */
public:
-
- void set(MEM_ROOT *root, const char *key_name_arg, uint key_len_arg)
+ String_list key_parts_list;
+
+ void clear()
{
- if (key_name_arg)
- {
- size_t name_len= strlen(key_name_arg);
- if ((key_name= (char*)alloc_root(root, name_len+1)))
- memcpy(key_name, key_name_arg, name_len+1);
- }
- else
- key_name= NULL;
- key_len= key_len_arg;
+ key_name= NULL;
+ key_len= (uint)-1;
}
+ void set(MEM_ROOT *root, KEY *key_name, uint key_len_arg);
+ void set_pseudo_key(MEM_ROOT *root, const char *key_name);
inline const char *get_key_name() { return key_name; }
inline uint get_key_len() { return key_len; }
@@ -448,6 +452,13 @@ public:
{}
const int quick_type;
+
+ bool is_basic()
+ {
+ return (quick_type == QUICK_SELECT_I::QS_TYPE_RANGE ||
+ quick_type == QUICK_SELECT_I::QS_TYPE_RANGE_DESC ||
+ quick_type == QUICK_SELECT_I::QS_TYPE_GROUP_MIN_MAX);
+ }
/* This is used when quick_type == QUICK_SELECT_I::QS_TYPE_RANGE */
Explain_index_use range;
@@ -458,16 +469,12 @@ public:
void print_extra(String *str);
void print_key(String *str);
void print_key_len(String *str);
-private:
- void print_extra_recursive(String *str);
- const char *get_name_by_type();
-};
+ void print_json(Json_writer *writer);
-class String_list: public List<char>
-{
-public:
- bool append_str(MEM_ROOT *mem_root, const char *str);
+ void print_extra_recursive(String *str);
+private:
+ const char *get_name_by_type();
};
@@ -565,7 +572,7 @@ public:
private:
void append_tag_name(String *str, enum explain_extra_tag tag);
- void fill_key_str(String *key_str);
+ void fill_key_str(String *key_str, bool is_json);
void fill_key_len_str(String *key_len_str);
double get_r_filtered();
void tag_to_json(Json_writer *writer, enum explain_extra_tag tag);