For the following query
SELECT al1.a FROM t1 AS al1, t1 AS al2
|
WHERE al1.a = al2.a HAVING al1.a != 3 ORDER BY al1.a;
|
the plan produced by SHOW EXPLAIN contains 'Using where; Using index' in the Extra field, while normal EXPLAIN only says 'Using index'.
bzr version-info
revision-id: psergey@askmonty.org-20120607171922-w5d79pe7733jrh2r
|
date: 2012-06-07 21:19:22 +0400
|
revno: 3412
|
Reproducible with Aria and InnoDB, with the default optimizer_switch.
SHOW EXPLAIN:
id select_type table type possible_keys key key_len ref rows Extra
|
1 SIMPLE al1 index a a 4 NULL 98 Using where; Using index
|
1 SIMPLE al2 ref a a 4 test.al1.a 11 Using index
|
EXPLAIN:
id select_type table type possible_keys key key_len ref rows Extra
|
1 SIMPLE al1 index a a 4 NULL 8 Using index
|
1 SIMPLE al2 ref a a 4 test.al1.a 11 Using index
|
Test case:
CREATE TABLE t1 (a INT NOT NULL, KEY(a)) ENGINE=Aria;
|
INSERT INTO t1 VALUES (4),(8),(0),(0),(0),(7),(7),(5),
|
(3),(188),(4),(9),(6),(1),(5),(6),(2),(4),(231),(4),
|
(3),(3),(7),(6),(7),(9),(4),(4),(2),(1),(2),(194),(2),
|
(3),(8),(4),(9),(4),(5),(5),(9),(3),(8),(0),(98),(3),
|
(1),(0),(189),(8),(3),(3),(9),(6),(8),(3),(9),(5),(9),
|
(2),(2),(5),(8),(6),(9),(0),(3),(6),(5),(8),(2),(120),
|
(25),(1),(3),(1),(3),(153),(5),(9),(1),(8),(7),(6),(2),
|
(4),(7),(3),(8),(4),(6),(1),(7),(1),(7),(2),(1),(5);
|
|
--connect (con1,localhost,root,,)
|
let $con_id = `SELECT CONNECTION_ID()`;
|
|
EXPLAIN
|
SELECT al1.a FROM t1 AS al1, t1 AS al2
|
WHERE al1.a = al2.a HAVING al1.a != 3 ORDER BY al1.a;
|
|
--send
|
SELECT al1.a FROM t1 AS al1, t1 AS al2
|
WHERE al1.a = al2.a HAVING al1.a != 3 ORDER BY al1.a;
|
|
--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 = 5;
|
while ($pass)
|
{
|
--error 0,ER_ERROR_WHEN_EXECUTING_COMMAND
|
--eval SHOW EXPLAIN FOR $con_id
|
--dec $pass
|
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":1444.3999999761581,"ttfb":500.39999997615814,"pageVisibility":"visible","entityId":12049,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"c2196766-ac03-46c9-95a0-e9f31a458aef","navigationType":0,"readyForUser":1600.6999999284744,"redirectCount":0,"resourceLoadedEnd":1992,"resourceLoadedStart":512.2999999523163,"resourceTiming":[{"duration":227,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":512.2999999523163,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":512.2999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":739.2999999523163,"responseStart":0,"secureConnectionStart":0},{"duration":227,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/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&whisper-enabled=true","startTime":512.5999999046326,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":512.5999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":739.5999999046326,"responseStart":0,"secureConnectionStart":0},{"duration":310.10000002384186,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":512.7999999523163,"connectEnd":512.7999999523163,"connectStart":512.7999999523163,"domainLookupEnd":512.7999999523163,"domainLookupStart":512.7999999523163,"fetchStart":512.7999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":512.7999999523163,"responseEnd":822.8999999761581,"responseStart":822.8999999761581,"secureConnectionStart":512.7999999523163},{"duration":387.1999999284744,"initiatorType":"script","name":"https://jira.mariadb.org/s/2d8175ec2fa4c816e8023260bd8c1786-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/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&whisper-enabled=true","startTime":513,"connectEnd":513,"connectStart":513,"domainLookupEnd":513,"domainLookupStart":513,"fetchStart":513,"redirectEnd":0,"redirectStart":0,"requestStart":513,"responseEnd":900.1999999284744,"responseStart":900.1999999284744,"secureConnectionStart":513},{"duration":390.60000002384186,"initiatorType":"script","name":"https://jira.mariadb.org/s/a9324d6758d385eb45c462685ad88f1d-CDN/lu2cib/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":513.1999999284744,"connectEnd":513.1999999284744,"connectStart":513.1999999284744,"domainLookupEnd":513.1999999284744,"domainLookupStart":513.1999999284744,"fetchStart":513.1999999284744,"redirectEnd":0,"redirectStart":0,"requestStart":513.1999999284744,"responseEnd":903.7999999523163,"responseStart":903.7999999523163,"secureConnectionStart":513.1999999284744},{"duration":391.60000002384186,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":513.3999999761581,"connectEnd":513.3999999761581,"connectStart":513.3999999761581,"domainLookupEnd":513.3999999761581,"domainLookupStart":513.3999999761581,"fetchStart":513.3999999761581,"redirectEnd":0,"redirectStart":0,"requestStart":513.3999999761581,"responseEnd":905,"responseStart":905,"secureConnectionStart":513.3999999761581},{"duration":403,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":513.5999999046326,"connectEnd":513.5999999046326,"connectStart":513.5999999046326,"domainLookupEnd":513.5999999046326,"domainLookupStart":513.5999999046326,"fetchStart":513.5999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":513.5999999046326,"responseEnd":916.5999999046326,"responseStart":916.5999999046326,"secureConnectionStart":513.5999999046326},{"duration":480.39999997615814,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2cib/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":513.7999999523163,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":513.7999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":994.1999999284744,"responseStart":0,"secureConnectionStart":0},{"duration":403.60000002384186,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":513.8999999761581,"connectEnd":513.8999999761581,"connectStart":513.8999999761581,"domainLookupEnd":513.8999999761581,"domainLookupStart":513.8999999761581,"fetchStart":513.8999999761581,"redirectEnd":0,"redirectStart":0,"requestStart":513.8999999761581,"responseEnd":917.5,"responseStart":917.5,"secureConnectionStart":513.8999999761581},{"duration":480.60000002384186,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2cib/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":514.0999999046326,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":514.0999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":994.6999999284744,"responseStart":0,"secureConnectionStart":0},{"duration":403.7999999523163,"initiatorType":"script","name":"https://jira.mariadb.org/s/5d5e8fe91fbc506585e83ea3b62ccc4b-CDN/lu2cib/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":514.2999999523163,"connectEnd":514.2999999523163,"connectStart":514.2999999523163,"domainLookupEnd":514.2999999523163,"domainLookupStart":514.2999999523163,"fetchStart":514.2999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":514.2999999523163,"responseEnd":918.0999999046326,"responseStart":918.0999999046326,"secureConnectionStart":514.2999999523163},{"duration":672.3000000715256,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":539.1999999284744,"connectEnd":539.1999999284744,"connectStart":539.1999999284744,"domainLookupEnd":539.1999999284744,"domainLookupStart":539.1999999284744,"fetchStart":539.1999999284744,"redirectEnd":0,"redirectStart":0,"requestStart":539.1999999284744,"responseEnd":1211.5,"responseStart":1211.5,"secureConnectionStart":539.1999999284744},{"duration":1448.1999999284744,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":539.3999999761581,"connectEnd":539.3999999761581,"connectStart":539.3999999761581,"domainLookupEnd":539.3999999761581,"domainLookupStart":539.3999999761581,"fetchStart":539.3999999761581,"redirectEnd":0,"redirectStart":0,"requestStart":539.3999999761581,"responseEnd":1987.5999999046326,"responseStart":1987.5999999046326,"secureConnectionStart":539.3999999761581},{"duration":201.39999997615814,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":1035.5,"connectEnd":1035.5,"connectStart":1035.5,"domainLookupEnd":1035.5,"domainLookupStart":1035.5,"fetchStart":1035.5,"redirectEnd":0,"redirectStart":0,"requestStart":1035.5,"responseEnd":1236.8999999761581,"responseStart":1236.8999999761581,"secureConnectionStart":1035.5},{"duration":617,"initiatorType":"link","name":"https://jira.mariadb.org/s/d5715adaadd168a9002b108b2b039b50-CDN/lu2cib/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&whisper-enabled=true","startTime":1375,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1375,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1992,"responseStart":0,"secureConnectionStart":0},{"duration":613,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/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&whisper-enabled=true","startTime":1376.1999999284744,"connectEnd":1376.1999999284744,"connectStart":1376.1999999284744,"domainLookupEnd":1376.1999999284744,"domainLookupStart":1376.1999999284744,"fetchStart":1376.1999999284744,"redirectEnd":0,"redirectStart":0,"requestStart":1376.1999999284744,"responseEnd":1989.1999999284744,"responseStart":1989.1999999284744,"secureConnectionStart":1376.1999999284744},{"duration":614.7999999523163,"initiatorType":"script","name":"https://jira.mariadb.org/s/097ae97cb8fbec7d6ea4bbb1f26955b9-CDN/lu2cib/820016/12ta74/be4b45e9cec53099498fa61c8b7acba4/_/download/contextbatch/js/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.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true&whisper-enabled=true","startTime":1376.5,"connectEnd":1376.5,"connectStart":1376.5,"domainLookupEnd":1376.5,"domainLookupStart":1376.5,"fetchStart":1376.5,"redirectEnd":0,"redirectStart":0,"requestStart":1376.5,"responseEnd":1991.2999999523163,"responseStart":1991.2999999523163,"secureConnectionStart":1376.5},{"duration":681.6000000238419,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":1435.3999999761581,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1435.3999999761581,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":2117,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":318,"responseStart":500,"responseEnd":531,"domLoading":510,"domInteractive":2125,"domContentLoadedEventStart":2125,"domContentLoadedEventEnd":2293,"domComplete":2474,"loadEventStart":2474,"loadEventEnd":2475,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":2065.1999999284744},{"name":"bigPipe.sidebar-id.end","time":2066.0999999046326},{"name":"bigPipe.activity-panel-pipe-id.start","time":2066.2999999523163},{"name":"bigPipe.activity-panel-pipe-id.end","time":2069},{"name":"activityTabFullyLoaded","time":2352.5999999046326}],"measures":[],"correlationId":"b4343a8a8b138d","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":112,"dbReadsTimeInMs":15,"dbConnsTimeInMs":24,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
With latest 5.5-show-explain, I was able to replicate with these sync commands:
set @show_explain_probe_select_id=1;
set debug_dbug='d,show_explain_probe_join_exec_start';
EXPLAIN:
+------+-------------+-------+-------+---------------+------+---------+------------+------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+------+-------------+-------+-------+---------------+------+---------+------------+------+-------------+
| 1 | SIMPLE | al1 | index | a | a | 4 | NULL | 8 | Using index |
| 1 | SIMPLE | al2 | ref | a | a | 4 | j326.al1.a | 11 | Using index |
+------+-------------+-------+-------+---------------+------+---------+------------+------+-------------+
SHOW EXPLAIN:
+------+-------------+-------+-------+---------------+------+---------+------------+------+-----------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+------+-------------+-------+-------+---------------+------+---------+------------+------+-----------------------------+
| 1 | SIMPLE | al1 | index | a | a | 4 | NULL | 98 | Using index; Using filesort |
| 1 | SIMPLE | al2 | ref | a | a | 4 | j326.al1.a | 11 | Using index |
+------+-------------+-------+-------+---------------+------+---------+------------+------+-----------------------------+