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
5ee1c25f
Commit
5ee1c25f
authored
Dec 06, 2014
by
Sergei Petrunia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
EXPLAIN FORMAT=JSON: Full scan on NULL key (join case)
parent
a80a7976
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
85 additions
and
0 deletions
+85
-0
mysql-test/r/explain_json.result
mysql-test/r/explain_json.result
+59
-0
mysql-test/t/explain_json.test
mysql-test/t/explain_json.test
+14
-0
sql/sql_explain.cc
sql/sql_explain.cc
+8
-0
sql/sql_explain.h
sql/sql_explain.h
+3
-0
sql/sql_select.cc
sql/sql_select.cc
+1
-0
No files found.
mysql-test/r/explain_json.result
View file @
5ee1c25f
...
...
@@ -719,3 +719,62 @@ EXPLAIN
}
drop table t1;
drop table t0;
#
# MDEV-7265: "Full scan on NULL key", the join case
#
CREATE TABLE t1 (a INT, KEY(a));
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (b INT);
INSERT INTO t2 VALUES (3),(4);
EXPLAIN FORMAT=JSON SELECT * FROM t1 AS outer_t1 WHERE a <> ALL ( SELECT a FROM t1, t2 WHERE b <> outer_t1.a );
EXPLAIN
{
"query_block": {
"select_id": 1,
"table": {
"table_name": "outer_t1",
"access_type": "index",
"key": "a",
"key_length": "5",
"used_key_parts": ["a"],
"rows": 2,
"filtered": 100,
"attached_condition": "(not(<in_optimizer>(outer_t1.a,<exists>(subquery#2))))",
"using_index": true
},
"subqueries": [
{
"query_block": {
"select_id": 2,
"full-scan-on-null_key": {
"table": {
"table_name": "t1",
"access_type": "ref_or_null",
"possible_keys": ["a"],
"key": "a",
"key_length": "5",
"used_key_parts": ["a"],
"ref": ["func"],
"rows": 2,
"filtered": 100,
"attached_condition": "trigcond(((<cache>(outer_t1.a) = t1.a) or isnull(t1.a)))",
"using_index": true
}
},
"block-nl-join": {
"table": {
"table_name": "t2",
"access_type": "ALL",
"rows": 2,
"filtered": 100
},
"buffer_type": "flat",
"join_type": "BNL",
"attached_condition": "((t2.b <> outer_t1.a) and trigcond(((<cache>(outer_t1.a) = t1.a) or isnull(t1.a))))"
}
}
}
]
}
}
DROP TABLE t1,t2;
mysql-test/t/explain_json.test
View file @
5ee1c25f
...
...
@@ -153,3 +153,17 @@ select * from t1 tbl1, t1 tbl2 where tbl2.a < tbl1.b;
drop
table
t1
;
drop
table
t0
;
--
echo
#
--
echo
# MDEV-7265: "Full scan on NULL key", the join case
--
echo
#
CREATE
TABLE
t1
(
a
INT
,
KEY
(
a
));
INSERT
INTO
t1
VALUES
(
1
),(
2
);
CREATE
TABLE
t2
(
b
INT
);
INSERT
INTO
t2
VALUES
(
3
),(
4
);
EXPLAIN
FORMAT
=
JSON
SELECT
*
FROM
t1
AS
outer_t1
WHERE
a
<>
ALL
(
SELECT
a
FROM
t1
,
t2
WHERE
b
<>
outer_t1
.
a
);
DROP
TABLE
t1
,
t2
;
sql/sql_explain.cc
View file @
5ee1c25f
...
...
@@ -1139,6 +1139,8 @@ void Explain_table_access::tag_to_json(Json_writer *writer, enum explain_extra_t
case
ET_START_TEMPORARY
:
case
ET_END_TEMPORARY
:
/* Handled as "duplicates_removal: { ... } */
case
ET_FULL_SCAN_ON_NULL_KEY
:
/* Handled in full_scan_on_null_key */
break
;
case
ET_FIRST_MATCH
:
writer
->
add_member
(
"first_match"
).
add_str
(
firstmatch_table_name
.
c_ptr
());
...
...
@@ -1188,6 +1190,9 @@ void Explain_table_access::print_explain_json(Explain_query *query,
add_json_keyset
(
writer
,
"keys"
,
&
possible_keys
);
}
if
(
full_scan_on_null_key
)
writer
->
add_member
(
"full-scan-on-null_key"
).
start_object
();
writer
->
add_member
(
"table"
).
start_object
();
writer
->
add_member
(
"table_name"
).
add_str
(
table_name
);
...
...
@@ -1289,6 +1294,9 @@ void Explain_table_access::print_explain_json(Explain_query *query,
tag_to_json
(
writer
,
extra_tags
.
at
(
i
));
}
if
(
full_scan_on_null_key
)
writer
->
end_object
();
//"full-scan-on-null_key"
if
(
range_checked_fer
)
writer
->
end_object
();
// "range-checked-for-each-record"
...
...
sql/sql_explain.h
View file @
5ee1c25f
...
...
@@ -562,6 +562,7 @@ public:
non_merged_sjm_number
(
0
),
extra_tags
(
root
),
range_checked_fer
(
NULL
),
full_scan_on_null_key
(
false
),
start_dups_weedout
(
false
),
end_dups_weedout
(
false
),
where_cond
(
NULL
),
...
...
@@ -634,6 +635,8 @@ public:
/* Non-NULL values means this tab uses "range checked for each record" */
Explain_range_checked_fer
*
range_checked_fer
;
bool
full_scan_on_null_key
;
// valid with ET_USING_JOIN_BUFFER
EXPLAIN_BKA_TYPE
bka_type
;
...
...
sql/sql_select.cc
View file @
5ee1c25f
...
...
@@ -23687,6 +23687,7 @@ void JOIN_TAB::save_explain_data(Explain_table_access *eta, table_map prefix_tab
if
(
tab
->
ref
.
cond_guards
[
part
])
{
eta
->
push_extra
(
ET_FULL_SCAN_ON_NULL_KEY
);
eta
->
full_scan_on_null_key
=
true
;
break
;
}
}
...
...
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