-
Bug
-
-
Minor
-
Resolution:
Fixed
-
None
-
-
None
-
For the following query
SELECT * FROM t1, ( SELECT * FROM t2 ) AS alias
|
WHERE a < ALL ( SELECT b FROM t1, t2 WHERE a = b )
|
with the default optimizer_switch the usual EXPLAIN returns
id select_type table type possible_keys key key_len ref rows Extra
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 20 Using where
|
1 PRIMARY t2 ALL NULL NULL NULL NULL 20 Using join buffer (flat, BNL join)
|
3 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 20
|
3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join)
|
while SHOW EXPLAIN produces
id select_type table type possible_keys key key_len ref rows Extra
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 20 Using where
|
1 PRIMARY t2 ALL NULL NULL NULL NULL 20 Using join buffer (flat, BNL join)
|
3 SUBQUERY t1 ALL NULL NULL NULL NULL 20
|
3 SUBQUERY t2 ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join)
|
bzr version-info
revision-id: psergey@askmonty.org-20120607171922-w5d79pe7733jrh2r
|
date: 2012-06-07 21:19:22 +0400
|
revno: 3412
|
Reproducible with MyISAM, Aria, InnoDB. The test case contains Aria because with MyISAM it is less reliable.
Test case:
CREATE TABLE t1 (a INT) ENGINE=Aria;
|
INSERT INTO t1 VALUES
|
(4),(6),(3),(5),(3),(246),(2),(9),(3),(8),
|
(1),(8),(8),(5),(7),(5),(1),(6),(2),(9);
|
|
CREATE TABLE t2 (b INT) ENGINE=Aria;
|
INSERT INTO t2 VALUES
|
(1),(7),(4),(7),(0),(2),(9),(4),(0),(9),
|
(1),(3),(8),(8),(18),(84),(6),(3),(6),(6);
|
|
--connect (con1,localhost,root,,)
|
let $con_id = `SELECT CONNECTION_ID()`;
|
|
EXPLAIN
|
SELECT * FROM t1, ( SELECT * FROM t2 ) AS alias
|
WHERE a < ALL ( SELECT b FROM t1, t2 WHERE a = b );
|
|
--send
|
SELECT * FROM t1, ( SELECT * FROM t2 ) AS alias
|
WHERE a < ALL ( SELECT b FROM t1, t2 WHERE a = b );
|
|
--connection default
|
let $fail = 100;
|
while ($fail)
|
{
|
--error 0,ER_ERROR_WHEN_EXECUTING_COMMAND
|
--eval SHOW EXPLAIN FOR $con_id
|
--dec $fail
|
if (!$mysql_errno)
|
{
|
let $fail = 0;
|
}
|
}
|
let $pass = 1;
|
while ($pass)
|
{
|
--error 0,ER_ERROR_WHEN_EXECUTING_COMMAND
|
--eval SHOW EXPLAIN FOR $con_id
|
if ($mysql_errno)
|
{
|
let $pass = 0;
|
}
|
}
|
|
--connection con1
|
--disable_result_log
|
--reap
|
|
- relates to
-
MDEV-165
MWL#182: Explain running statements: finish coding, submit for review
-
-
Closed
{"report":{"fcp":640.8000000715256,"ttfb":175.60000002384186,"pageVisibility":"visible","entityId":12050,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":1,"journeyId":"38cdfb89-88bb-47ec-adcd-c10014dc15ae","navigationType":0,"readyForUser":776.1000000238419,"redirectCount":0,"resourceLoadedEnd":661.6000000238419,"resourceLoadedStart":180.80000007152557,"resourceTiming":[{"duration":6.399999976158142,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":180.80000007152557,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":180.80000007152557,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":187.20000004768372,"responseStart":0,"secureConnectionStart":0},{"duration":6.300000071525574,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2bu7/820016/12ta74/8679b4946efa1a0bb029a3a22206fb5d/_/download/contextbatch/css/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true","startTime":181.10000002384186,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":181.10000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":187.40000009536743,"responseStart":0,"secureConnectionStart":0},{"duration":61.39999997615814,"initiatorType":"script","name":"https://jira.mariadb.org/s/fbf975c0cce4b1abf04784eeae9ba1f4-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":181.10000002384186,"connectEnd":181.10000002384186,"connectStart":181.10000002384186,"domainLookupEnd":181.10000002384186,"domainLookupStart":181.10000002384186,"fetchStart":181.10000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":181.10000002384186,"responseEnd":242.5,"responseStart":242.5,"secureConnectionStart":181.10000002384186},{"duration":142.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/099b33461394b8015fc36c0a4b96e19f-CDN/lu2bu7/820016/12ta74/8679b4946efa1a0bb029a3a22206fb5d/_/download/contextbatch/js/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true","startTime":181.20000004768372,"connectEnd":181.20000004768372,"connectStart":181.20000004768372,"domainLookupEnd":181.20000004768372,"domainLookupStart":181.20000004768372,"fetchStart":181.20000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":181.20000004768372,"responseEnd":323.7000000476837,"responseStart":323.7000000476837,"secureConnectionStart":181.20000004768372},{"duration":146.59999990463257,"initiatorType":"script","name":"https://jira.mariadb.org/s/94c15bff32baef80f4096a08aceae8bc-CDN/lu2bu7/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":181.40000009536743,"connectEnd":181.40000009536743,"connectStart":181.40000009536743,"domainLookupEnd":181.40000009536743,"domainLookupStart":181.40000009536743,"fetchStart":181.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":181.40000009536743,"responseEnd":328,"responseStart":328,"secureConnectionStart":181.40000009536743},{"duration":147.10000002384186,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":181.5,"connectEnd":181.5,"connectStart":181.5,"domainLookupEnd":181.5,"domainLookupStart":181.5,"fetchStart":181.5,"redirectEnd":0,"redirectStart":0,"requestStart":181.5,"responseEnd":328.60000002384186,"responseStart":328.60000002384186,"secureConnectionStart":181.5},{"duration":147.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":181.5,"connectEnd":181.5,"connectStart":181.5,"domainLookupEnd":181.5,"domainLookupStart":181.5,"fetchStart":181.5,"redirectEnd":0,"redirectStart":0,"requestStart":181.5,"responseEnd":329,"responseStart":329,"secureConnectionStart":181.5},{"duration":147.89999997615814,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2bu7/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":181.60000002384186,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":181.60000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":329.5,"responseStart":0,"secureConnectionStart":0},{"duration":147.70000004768372,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":181.70000004768372,"connectEnd":181.70000004768372,"connectStart":181.70000004768372,"domainLookupEnd":181.70000004768372,"domainLookupStart":181.70000004768372,"fetchStart":181.70000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":181.70000004768372,"responseEnd":329.40000009536743,"responseStart":329.40000009536743,"secureConnectionStart":181.70000004768372},{"duration":148,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2bu7/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/css/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.css?jira.create.linked.issue=true","startTime":181.90000009536743,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":181.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":329.90000009536743,"responseStart":0,"secureConnectionStart":0},{"duration":148.19999992847443,"initiatorType":"script","name":"https://jira.mariadb.org/s/3339d87fa2538a859872f2df449bf8d0-CDN/lu2bu7/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/js/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.js?jira.create.linked.issue=true&locale=en","startTime":181.90000009536743,"connectEnd":181.90000009536743,"connectStart":181.90000009536743,"domainLookupEnd":181.90000009536743,"domainLookupStart":181.90000009536743,"fetchStart":181.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":181.90000009536743,"responseEnd":330.10000002384186,"responseStart":330.10000002384186,"secureConnectionStart":181.90000009536743},{"duration":419.39999997615814,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":187.40000009536743,"connectEnd":187.40000009536743,"connectStart":187.40000009536743,"domainLookupEnd":187.40000009536743,"domainLookupStart":187.40000009536743,"fetchStart":187.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":187.40000009536743,"responseEnd":606.8000000715256,"responseStart":606.8000000715256,"secureConnectionStart":187.40000009536743},{"duration":417.7999999523163,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":198.80000007152557,"connectEnd":198.80000007152557,"connectStart":198.80000007152557,"domainLookupEnd":198.80000007152557,"domainLookupStart":198.80000007152557,"fetchStart":198.80000007152557,"redirectEnd":0,"redirectStart":0,"requestStart":198.80000007152557,"responseEnd":616.6000000238419,"responseStart":616.6000000238419,"secureConnectionStart":198.80000007152557},{"duration":208.39999997615814,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":398.90000009536743,"connectEnd":398.90000009536743,"connectStart":398.90000009536743,"domainLookupEnd":398.90000009536743,"domainLookupStart":398.90000009536743,"fetchStart":398.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":398.90000009536743,"responseEnd":607.3000000715256,"responseStart":607.3000000715256,"secureConnectionStart":398.90000009536743},{"duration":2.200000047683716,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":633.6000000238419,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":633.6000000238419,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":635.8000000715256,"responseStart":0,"secureConnectionStart":0},{"duration":3.6999999284744263,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/e65b778d185daf5aee24936755b43da6/_/download/contextbatch/js/browser-metrics-plugin.contrib,-_super,-project.issue.navigator,-jira.view.issue,-atl.general/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true","startTime":657.9000000953674,"connectEnd":657.9000000953674,"connectStart":657.9000000953674,"domainLookupEnd":657.9000000953674,"domainLookupStart":657.9000000953674,"fetchStart":657.9000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":657.9000000953674,"responseEnd":661.6000000238419,"responseStart":661.6000000238419,"secureConnectionStart":657.9000000953674}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":10,"responseStart":175,"responseEnd":198,"domLoading":178,"domInteractive":846,"domContentLoadedEventStart":846,"domContentLoadedEventEnd":895,"domComplete":1149,"loadEventStart":1149,"loadEventEnd":1149,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":817.7000000476837},{"name":"bigPipe.sidebar-id.end","time":818.4000000953674},{"name":"bigPipe.activity-panel-pipe-id.start","time":818.6000000238419},{"name":"bigPipe.activity-panel-pipe-id.end","time":820.4000000953674},{"name":"activityTabFullyLoaded","time":914.2000000476837}],"measures":[],"correlationId":"c453633b393aa","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":91,"dbReadsTimeInMs":11,"dbConnsTimeInMs":18,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
There is an interesting difference:
MariaDB [j2]> explain extended SELECT * FROM t1, t2 AS alias WHERE a < ALL ( SELECT b FROM t1, t2 WHERE a = b );
+------+-------------+-------+------+---------------+------+---------+------+------+----------+-------------------------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
+------+-------------+-------+------+---------------+------+---------+------+------+----------+-------------------------------------------------+
| 1 | PRIMARY | t1 | ALL | NULL | NULL | NULL | NULL | 20 | 100.00 | Using where |
| 1 | PRIMARY | alias | ALL | NULL | NULL | NULL | NULL | 20 | 100.00 | Using join buffer (flat, BNL join) |
| 2 | SUBQUERY | t1 | ALL | NULL | NULL | NULL | NULL | 20 | 100.00 | |
| 2 | SUBQUERY | t2 | ALL | NULL | NULL | NULL | NULL | 20 | 100.00 | Using where; Using join buffer (flat, BNL join) |
+------+-------------+-------+------+---------------+------+---------+------+------+----------+-------------------------------------------------+
4 rows in set, 1 warning (0.00 sec)
MariaDB [j2]> explain extended SELECT * FROM t1, ( SELECT * FROM t2 ) AS alias WHERE a < ALL ( SELECT b FROM t1, t2 WHERE a = b );
+------+--------------------+-------+------+---------------+------+---------+------+------+----------+-------------------------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
+------+--------------------+-------+------+---------------+------+---------+------+------+----------+-------------------------------------------------+
| 1 | PRIMARY | t1 | ALL | NULL | NULL | NULL | NULL | 20 | 100.00 | Using where |
| 1 | PRIMARY | t2 | ALL | NULL | NULL | NULL | NULL | 20 | 100.00 | Using join buffer (flat, BNL join) |
| 3 | DEPENDENT SUBQUERY | t1 | ALL | NULL | NULL | NULL | NULL | 20 | 100.00 | |
| 3 | DEPENDENT SUBQUERY | t2 | ALL | NULL | NULL | NULL | NULL | 20 | 100.00 | Using where; Using join buffer (flat, BNL join) |
+------+--------------------+-------+------+---------------+------+---------+------+------+----------+-------------------------------------------------+
4 rows in set, 1 warning (0.00 sec)