Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
b05383cb
Commit
b05383cb
authored
Apr 08, 2015
by
Oleksandr Byelkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-7835: ANALYZE FORMAT=JSON should show buffer sizes
parent
69719446
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
35 additions
and
0 deletions
+35
-0
mysql-test/r/analyze_format_json.result
mysql-test/r/analyze_format_json.result
+2
-0
mysql-test/r/explain_json.result
mysql-test/r/explain_json.result
+6
-0
sql/my_json_writer.cc
sql/my_json_writer.cc
+21
-0
sql/my_json_writer.h
sql/my_json_writer.h
+1
-0
sql/sql_explain.cc
sql/sql_explain.cc
+1
-0
sql/sql_explain.h
sql/sql_explain.h
+2
-0
sql/sql_join_cache.cc
sql/sql_join_cache.cc
+2
-0
No files found.
mysql-test/r/analyze_format_json.result
View file @
b05383cb
...
...
@@ -143,6 +143,7 @@ ANALYZE
"attached_condition": "(tbl2.b < 60)"
},
"buffer_type": "flat",
"buffer_size": "128Kb",
"join_type": "BNL",
"r_filtered": 100
}
...
...
@@ -180,6 +181,7 @@ ANALYZE
"attached_condition": "(tbl2.b < 60)"
},
"buffer_type": "flat",
"buffer_size": "128Kb",
"join_type": "BNL",
"attached_condition": "(tbl1.c > tbl2.c)",
"r_filtered": 15.833
...
...
mysql-test/r/explain_json.result
View file @
b05383cb
...
...
@@ -365,6 +365,7 @@ EXPLAIN
"attached_condition": "(tbl2.b < 5)"
},
"buffer_type": "flat",
"buffer_size": "128Kb",
"join_type": "BNL",
"attached_condition": "(tbl2.a = tbl1.a)"
}
...
...
@@ -618,6 +619,7 @@ EXPLAIN
"filtered": 100
},
"buffer_type": "flat",
"buffer_size": "128Kb",
"join_type": "BNL"
}
}
...
...
@@ -651,6 +653,7 @@ EXPLAIN
"first_match": "t2"
},
"buffer_type": "flat",
"buffer_size": "128Kb",
"join_type": "BNL",
"attached_condition": "((t1.b = t2.b) and (t1.a = t2.a))"
}
...
...
@@ -687,6 +690,7 @@ EXPLAIN
"filtered": 100
},
"buffer_type": "flat",
"buffer_size": "128Kb",
"join_type": "BNL",
"attached_condition": "((t1.b = t2.b) and (t1.a = t2.a))"
}
...
...
@@ -799,6 +803,7 @@ EXPLAIN
"filtered": 100
},
"buffer_type": "flat",
"buffer_size": "128Kb",
"join_type": "BNL",
"attached_condition": "((t2.b <> outer_t1.a) and trigcond(((<cache>(outer_t1.a) = t1.a) or isnull(t1.a))))"
}
...
...
@@ -849,6 +854,7 @@ EXPLAIN
"filtered": 100
},
"buffer_type": "flat",
"buffer_size": "128Kb",
"join_type": "BNL",
"attached_condition": "(tbl2.b = tbl1.b)"
}
...
...
sql/my_json_writer.cc
View file @
b05383cb
...
...
@@ -130,6 +130,27 @@ void Json_writer::add_ll(longlong val)
}
/* Add a memory size, printing in Kb, Kb, Gb if necessary */
void
Json_writer
::
add_size
(
longlong
val
)
{
char
buf
[
64
];
if
(
val
<
1024
)
my_snprintf
(
buf
,
sizeof
(
buf
),
"%ld"
,
val
);
else
if
(
val
<
1024
*
1024
*
16
)
{
/* Values less than 16MB are specified in KB for precision */
size_t
len
=
my_snprintf
(
buf
,
sizeof
(
buf
),
"%ld"
,
val
/
1024
);
strcpy
(
buf
+
len
,
"Kb"
);
}
else
{
size_t
len
=
my_snprintf
(
buf
,
sizeof
(
buf
),
"%ld"
,
val
/
(
1024
*
1024
));
strcpy
(
buf
+
len
,
"Mb"
);
}
add_str
(
buf
);
}
void
Json_writer
::
add_double
(
double
val
)
{
char
buf
[
64
];
...
...
sql/my_json_writer.h
View file @
b05383cb
...
...
@@ -108,6 +108,7 @@ public:
void
add_str
(
const
String
&
str
);
void
add_ll
(
longlong
val
);
void
add_size
(
longlong
val
);
void
add_double
(
double
val
);
void
add_bool
(
bool
val
);
void
add_null
();
...
...
sql/sql_explain.cc
View file @
b05383cb
...
...
@@ -1360,6 +1360,7 @@ void Explain_table_access::print_explain_json(Explain_query *query,
writer
->
end_object
();
// "block-nl-join"
writer
->
add_member
(
"buffer_type"
).
add_str
(
bka_type
.
incremental
?
"incremental"
:
"flat"
);
writer
->
add_member
(
"buffer_size"
).
add_size
(
bka_type
.
join_buffer_size
);
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
);
...
...
sql/sql_explain.h
View file @
b05383cb
...
...
@@ -511,6 +511,8 @@ class EXPLAIN_BKA_TYPE
public:
EXPLAIN_BKA_TYPE
()
:
join_alg
(
NULL
)
{}
size_t
join_buffer_size
;
bool
incremental
;
/*
...
...
sql/sql_join_cache.cc
View file @
b05383cb
...
...
@@ -2582,6 +2582,8 @@ void JOIN_CACHE::save_explain_data(EXPLAIN_BKA_TYPE *explain)
{
explain
->
incremental
=
MY_TEST
(
prev_cache
);
explain
->
join_buffer_size
=
get_join_buffer_size
();
switch
(
get_join_alg
())
{
case
BNL_JOIN_ALG
:
explain
->
join_alg
=
"BNL"
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment