-
Bug
-
-
Major
-
Resolution:
Fixed
-
None
-
-
None
-
For the following query
SELECT MIN(b) FROM ( SELECT * FROM t1, t2, t3 WHERE d = b ) AS alias1
|
WHERE SLEEP(0.2) OR c < 'p' OR b = ( SELECT MIN(b) FROM t2 )
|
usual EXPLAIN produces
id select_type table type possible_keys key key_len ref rows Extra
|
1 PRIMARY t1 system NULL NULL NULL NULL 1
|
1 PRIMARY t2 range b b 5 NULL 2 Using index condition; Using where
|
1 PRIMARY t3 ref d d 5 test.t2.b 2 Using where; Using index
|
3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
while SHOW EXPLAIN says
id select_type table type possible_keys key key_len ref rows Extra
|
1 PRIMARY t1 system NULL NULL NULL NULL 1
|
1 PRIMARY t2 ALL b NULL NULL NULL 2 Using where
|
1 PRIMARY t3 ref d d 5 test.t2.b 2 Using where; Using index
|
3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
As always, SLEEP in the query is not essential, it just makes the query a bit longer and allows to catch it by SHOW EXPLAIN.
bzr version-info (5.5-show-explain-test1)
revision-id: psergey@askmonty.org-20120719215203-m2p9cbqb37n0th7n
|
date: 2012-07-20 01:52:03 +0400
|
build-date: 2012-07-24 04:43:23 +0400
|
revno: 3456
|
Test case:
|
CREATE TABLE t1 (a VARCHAR(3) PRIMARY KEY) ENGINE=MyISAM;
|
INSERT INTO t1 VALUES ('USA');
|
|
CREATE TABLE t2 (b INT, c VARCHAR(52), KEY(b)) ENGINE=MyISAM;
|
INSERT INTO t2 VALUES (3813,'United States'),(3940,'Russia');
|
|
CREATE TABLE t3 (d INT, KEY(d)) ENGINE=MyISAM;
|
INSERT INTO t3 VALUES (12),(22),(9),(45);
|
|
EXPLAIN
|
SELECT MIN(b) FROM ( SELECT * FROM t1, t2, t3 WHERE d = b ) AS alias1
|
WHERE SLEEP(0.2) OR c < 'p' OR b = ( SELECT MIN(b) FROM t2 );
|
--echo #---------------
|
--echo # SHOW EXPLAIN output:
|
|
--connect (con1,localhost,root,,)
|
--let $con_id = `SELECT CONNECTION_ID()`
|
|
--let $trials = 50
|
|
--disable_query_log
|
|
while ($trials)
|
{
|
--dec $trials
|
--let $run = 1000
|
|
send
|
SELECT MIN(b) FROM ( SELECT * FROM t1, t2, t3 WHERE d = b ) AS alias1
|
WHERE SLEEP(0.2) OR c < 'p' OR b = ( SELECT MIN(b) FROM t2 );
|
|
|
--connection default
|
while ($run)
|
{
|
--error 0,1932
|
eval SHOW EXPLAIN FOR $con_id;
|
--dec $run
|
if (!$mysql_errno)
|
{
|
--let $run = 0
|
--let $trials = 0
|
--let $found = 1
|
}
|
}
|
|
--disable_result_log
|
--connection con1
|
--reap
|
--enable_result_log
|
|
}
|
|
if (!$found)
|
{
|
--echo ########### Could not catch the query by SHOW EXPLAIN, try again #############
|
}
|
|
DROP TABLE t1, t2, t3;
|
- relates to
-
MDEV-165
MWL#182: Explain running statements: finish coding, submit for review
-
-
Closed
{"report":{"fcp":864.5,"ttfb":140.5,"pageVisibility":"visible","entityId":13478,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":1,"journeyId":"11fb3be0-57da-4cd3-8058-b337f548a83f","navigationType":0,"readyForUser":949.9000000953674,"redirectCount":0,"resourceLoadedEnd":921.7999999523163,"resourceLoadedStart":146.29999995231628,"resourceTiming":[{"duration":241.70000004768372,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":146.29999995231628,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":146.29999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":388,"responseStart":0,"secureConnectionStart":0},{"duration":241.5,"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":146.59999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":146.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":388.09999990463257,"responseStart":0,"secureConnectionStart":0},{"duration":250.79999995231628,"initiatorType":"script","name":"https://jira.mariadb.org/s/fbf975c0cce4b1abf04784eeae9ba1f4-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":146.70000004768372,"connectEnd":146.70000004768372,"connectStart":146.70000004768372,"domainLookupEnd":146.70000004768372,"domainLookupStart":146.70000004768372,"fetchStart":146.70000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":146.70000004768372,"responseEnd":397.5,"responseStart":397.5,"secureConnectionStart":146.70000004768372},{"duration":353.60000014305115,"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":146.79999995231628,"connectEnd":146.79999995231628,"connectStart":146.79999995231628,"domainLookupEnd":146.79999995231628,"domainLookupStart":146.79999995231628,"fetchStart":146.79999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":146.79999995231628,"responseEnd":500.40000009536743,"responseStart":500.40000009536743,"secureConnectionStart":146.79999995231628},{"duration":357.19999980926514,"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":146.90000009536743,"connectEnd":146.90000009536743,"connectStart":146.90000009536743,"domainLookupEnd":146.90000009536743,"domainLookupStart":146.90000009536743,"fetchStart":146.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":146.90000009536743,"responseEnd":504.09999990463257,"responseStart":504.09999990463257,"secureConnectionStart":146.90000009536743},{"duration":357.59999990463257,"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":147,"connectEnd":147,"connectStart":147,"domainLookupEnd":147,"domainLookupStart":147,"fetchStart":147,"redirectEnd":0,"redirectStart":0,"requestStart":147,"responseEnd":504.59999990463257,"responseStart":504.59999990463257,"secureConnectionStart":147},{"duration":357.7999999523163,"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":147.20000004768372,"connectEnd":147.20000004768372,"connectStart":147.20000004768372,"domainLookupEnd":147.20000004768372,"domainLookupStart":147.20000004768372,"fetchStart":147.20000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":147.20000004768372,"responseEnd":505,"responseStart":505,"secureConnectionStart":147.20000004768372},{"duration":358.10000014305115,"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":147.29999995231628,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":147.29999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":505.40000009536743,"responseStart":0,"secureConnectionStart":0},{"duration":358.10000014305115,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":147.29999995231628,"connectEnd":147.29999995231628,"connectStart":147.29999995231628,"domainLookupEnd":147.29999995231628,"domainLookupStart":147.29999995231628,"fetchStart":147.29999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":147.29999995231628,"responseEnd":505.40000009536743,"responseStart":505.40000009536743,"secureConnectionStart":147.29999995231628},{"duration":358.40000009536743,"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":147.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":147.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":505.90000009536743,"responseStart":0,"secureConnectionStart":0},{"duration":358.40000009536743,"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":147.59999990463257,"connectEnd":147.59999990463257,"connectStart":147.59999990463257,"domainLookupEnd":147.59999990463257,"domainLookupStart":147.59999990463257,"fetchStart":147.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":147.59999990463257,"responseEnd":506,"responseStart":506,"secureConnectionStart":147.59999990463257},{"duration":451.59999990463257,"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":148.5,"connectEnd":148.5,"connectStart":148.5,"domainLookupEnd":148.5,"domainLookupStart":148.5,"fetchStart":148.5,"redirectEnd":0,"redirectStart":0,"requestStart":148.5,"responseEnd":600.0999999046326,"responseStart":600.0999999046326,"secureConnectionStart":148.5},{"duration":759.2000000476837,"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":148.5,"connectEnd":148.5,"connectStart":148.5,"domainLookupEnd":148.5,"domainLookupStart":148.5,"fetchStart":148.5,"redirectEnd":0,"redirectStart":0,"requestStart":148.5,"responseEnd":907.7000000476837,"responseStart":907.7000000476837,"secureConnectionStart":148.5},{"duration":52.90000009536743,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":548.5,"connectEnd":548.5,"connectStart":548.5,"domainLookupEnd":548.5,"domainLookupStart":548.5,"fetchStart":548.5,"redirectEnd":0,"redirectStart":0,"requestStart":548.5,"responseEnd":601.4000000953674,"responseStart":601.4000000953674,"secureConnectionStart":548.5},{"duration":137.09999990463257,"initiatorType":"link","name":"https://jira.mariadb.org/s/d5715adaadd168a9002b108b2b039b50-CDN/lu2bu7/820016/12ta74/be4b45e9cec53099498fa61c8b7acba4/_/download/contextbatch/css/jira.project.sidebar,-_super,-project.issue.navigator,-jira.general,-jira.browse.project,-jira.view.issue,-jira.global,-atl.general,-com.atlassian.jira.projects.sidebar.init/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true","startTime":784.7000000476837,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":784.7000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":921.7999999523163,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":14,"responseStart":140,"responseEnd":141,"domLoading":143,"domInteractive":1014,"domContentLoadedEventStart":1014,"domContentLoadedEventEnd":1063,"domComplete":1747,"loadEventStart":1747,"loadEventEnd":1749,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":992.9000000953674},{"name":"bigPipe.sidebar-id.end","time":993.7000000476837},{"name":"bigPipe.activity-panel-pipe-id.start","time":993.7999999523163},{"name":"bigPipe.activity-panel-pipe-id.end","time":996.2999999523163},{"name":"activityTabFullyLoaded","time":1070.7999999523163}],"measures":[],"correlationId":"fc6ad29f6073f5","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":64,"dbReadsTimeInMs":9,"dbConnsTimeInMs":15,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}