In MariaDB 5.3 the output from the EXPLAIN of the test case for lp bug #714999 is
MariaDB [test]> EXPLAIN SELECT f2 FROM t3 WHERE (
-> SELECT MAX( pk ) FROM t1
-> WHERE EXISTS (
-> SELECT max(f1)
-> FROM t2 GROUP BY f1
-> )
-> ) IS NULL ;
-------------------------------------------------------------------------------------------------------------+
id |
select_type |
table |
type |
possible_keys |
key |
key_len |
ref |
rows |
Extra |
-------------------------------------------------------------------------------------------------------------+
1 |
PRIMARY |
NULL |
NULL |
NULL |
NULL |
NULL |
NULL |
NULL |
Impossible WHERE noticed after reading const tables |
2 |
SUBQUERY |
t1 |
system |
NULL |
NULL |
NULL |
NULL |
1 |
|
3 |
SUBQUERY |
t2 |
ALL |
NULL |
NULL |
NULL |
NULL |
2 |
Using temporary; Using filesort |
-------------------------------------------------------------------------------------------------------------+
So the expected number of examined rows from t2 is 2 and that is correct.
Yet in MariaDB 5.5 the EXPLAIN output for the same test case is
MariaDB [test]> EXPLAIN SELECT f2 FROM t3 WHERE (
-> SELECT MAX( pk ) FROM t1
-> WHERE EXISTS (
-> SELECT max(f1)
-> FROM t2 GROUP BY f1
-> )
-> ) IS NULL ;
----------------------------------------------------------------------------------------------------------------------------+
id |
select_type |
table |
type |
possible_keys |
key |
key_len |
ref |
rows |
Extra |
----------------------------------------------------------------------------------------------------------------------------+
1 |
PRIMARY |
NULL |
NULL |
NULL |
NULL |
NULL |
NULL |
NULL |
Impossible WHERE noticed after reading const tables |
2 |
SUBQUERY |
t1 |
system |
NULL |
NULL |
NULL |
NULL |
1 |
|
3 |
SUBQUERY |
internal_tmp_table |
ALL |
group_key |
NULL |
NULL |
NULL |
1 |
Using temporary; Using filesort |
----------------------------------------------------------------------------------------------------------------------------+
Here the name of the table in the third line is 'internal_tmp_table' and the expected number of the examined rows is 1.
Apparently this is not correct. This line of the EXPLAIN output is for the plan of the uncorrelated sub-query 'SELECT max(f1)FROM t2 GROUP BY f1'.
This change in the plan appeared after the patch that fixes lp bug #944706.
I consider this as a serious regression bug.
{"report":{"fcp":760.2000000476837,"ttfb":180.5,"pageVisibility":"visible","entityId":13618,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":1,"journeyId":"c0590887-6625-4c21-a6d6-988b6c37d49d","navigationType":0,"readyForUser":836.3000001907349,"redirectCount":0,"resourceLoadedEnd":825.9000000953674,"resourceLoadedStart":186.70000004768372,"resourceTiming":[{"duration":45.40000009536743,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":186.70000004768372,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":186.70000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":232.10000014305115,"responseStart":0,"secureConnectionStart":0},{"duration":45.39999985694885,"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":187.10000014305115,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":187.10000014305115,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":232.5,"responseStart":0,"secureConnectionStart":0},{"duration":107.90000009536743,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":187.20000004768372,"connectEnd":187.20000004768372,"connectStart":187.20000004768372,"domainLookupEnd":187.20000004768372,"domainLookupStart":187.20000004768372,"fetchStart":187.20000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":187.20000004768372,"responseEnd":295.10000014305115,"responseStart":295.10000014305115,"secureConnectionStart":187.20000004768372},{"duration":202.30000019073486,"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":187.5,"connectEnd":187.5,"connectStart":187.5,"domainLookupEnd":187.5,"domainLookupStart":187.5,"fetchStart":187.5,"redirectEnd":0,"redirectStart":0,"requestStart":187.5,"responseEnd":389.80000019073486,"responseStart":389.80000019073486,"secureConnectionStart":187.5},{"duration":206.29999995231628,"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":187.70000004768372,"connectEnd":187.70000004768372,"connectStart":187.70000004768372,"domainLookupEnd":187.70000004768372,"domainLookupStart":187.70000004768372,"fetchStart":187.70000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":187.70000004768372,"responseEnd":394,"responseStart":394,"secureConnectionStart":187.70000004768372},{"duration":206.59999990463257,"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":187.80000019073486,"connectEnd":187.80000019073486,"connectStart":187.80000019073486,"domainLookupEnd":187.80000019073486,"domainLookupStart":187.80000019073486,"fetchStart":187.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":187.80000019073486,"responseEnd":394.40000009536743,"responseStart":394.40000009536743,"secureConnectionStart":187.80000019073486},{"duration":206.70000004768372,"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":188,"connectEnd":188,"connectStart":188,"domainLookupEnd":188,"domainLookupStart":188,"fetchStart":188,"redirectEnd":0,"redirectStart":0,"requestStart":188,"responseEnd":394.7000000476837,"responseStart":394.7000000476837,"secureConnectionStart":188},{"duration":257.60000014305115,"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":188.20000004768372,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":188.20000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":445.80000019073486,"responseStart":0,"secureConnectionStart":0},{"duration":206.79999995231628,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":188.30000019073486,"connectEnd":188.30000019073486,"connectStart":188.30000019073486,"domainLookupEnd":188.30000019073486,"domainLookupStart":188.30000019073486,"fetchStart":188.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":188.30000019073486,"responseEnd":395.10000014305115,"responseStart":395.10000014305115,"secureConnectionStart":188.30000019073486},{"duration":257.60000014305115,"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":188.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":188.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":446.10000014305115,"responseStart":0,"secureConnectionStart":0},{"duration":207,"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":188.70000004768372,"connectEnd":188.70000004768372,"connectStart":188.70000004768372,"domainLookupEnd":188.70000004768372,"domainLookupStart":188.70000004768372,"fetchStart":188.70000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":188.70000004768372,"responseEnd":395.7000000476837,"responseStart":395.7000000476837,"secureConnectionStart":188.70000004768372},{"duration":557.6000001430511,"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":189.5,"connectEnd":189.5,"connectStart":189.5,"domainLookupEnd":189.5,"domainLookupStart":189.5,"fetchStart":189.5,"redirectEnd":0,"redirectStart":0,"requestStart":189.5,"responseEnd":747.1000001430511,"responseStart":747.1000001430511,"secureConnectionStart":189.5},{"duration":562.7000000476837,"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":189.60000014305115,"connectEnd":189.60000014305115,"connectStart":189.60000014305115,"domainLookupEnd":189.60000014305115,"domainLookupStart":189.60000014305115,"fetchStart":189.60000014305115,"redirectEnd":0,"redirectStart":0,"requestStart":189.60000014305115,"responseEnd":752.3000001907349,"responseStart":752.3000001907349,"secureConnectionStart":189.60000014305115},{"duration":38.59999990463257,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":457.40000009536743,"connectEnd":457.40000009536743,"connectStart":457.40000009536743,"domainLookupEnd":457.40000009536743,"domainLookupStart":457.40000009536743,"fetchStart":457.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":457.40000009536743,"responseEnd":496,"responseStart":496,"secureConnectionStart":457.40000009536743},{"duration":254.89999985694885,"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":499.30000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":499.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":754.2000000476837,"responseStart":0,"secureConnectionStart":0},{"duration":323.09999990463257,"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":500.30000019073486,"connectEnd":500.30000019073486,"connectStart":500.30000019073486,"domainLookupEnd":500.30000019073486,"domainLookupStart":500.30000019073486,"fetchStart":500.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":500.30000019073486,"responseEnd":823.4000000953674,"responseStart":823.4000000953674,"secureConnectionStart":500.30000019073486},{"duration":325.2999999523163,"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":500.60000014305115,"connectEnd":500.60000014305115,"connectStart":500.60000014305115,"domainLookupEnd":500.60000014305115,"domainLookupStart":500.60000014305115,"fetchStart":500.60000014305115,"redirectEnd":0,"redirectStart":0,"requestStart":500.60000014305115,"responseEnd":825.9000000953674,"responseStart":825.9000000953674,"secureConnectionStart":500.60000014305115},{"duration":141,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":753.7000000476837,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":753.7000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":894.7000000476837,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":15,"responseStart":181,"responseEnd":182,"domLoading":185,"domInteractive":907,"domContentLoadedEventStart":907,"domContentLoadedEventEnd":954,"domComplete":1169,"loadEventStart":1169,"loadEventEnd":1169,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":876.2000000476837},{"name":"bigPipe.sidebar-id.end","time":877.1000001430511},{"name":"bigPipe.activity-panel-pipe-id.start","time":877.2000000476837},{"name":"bigPipe.activity-panel-pipe-id.end","time":878.2000000476837},{"name":"activityTabFullyLoaded","time":1008.6000001430511}],"measures":[],"correlationId":"5b3d91db70bee2","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":102,"dbReadsTimeInMs":10,"dbConnsTimeInMs":18,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
This should be fixed by backporting the relevant part of SHOW EXPLAIN.