Type:
Bug
Priority:
Major
Resolution:
Unresolved
Affects Version/s:
10.3(EOL) , 10.4(EOL) , 10.5 , 10.6 , 10.7(EOL) , 10.8(EOL) , 10.9(EOL) , 10.10(EOL) , 10.11
CREATE TABLE t1 (a INT );
INSERT INTO t1 VALUES (8),(9);
CREATE TABLE t2 (b INT );
INSERT INTO t2 VALUES (1),(2);
CREATE TABLE t3 (c INT , d DATE );
INSERT INTO t3 VALUES (2, '2022-12-12' ),(3, '2023-12-12' );
SELECT c, ( SELECT MIN (a) FROM t1 WHERE t3.c IN ( SELECT b FROM t2)) AS f1, GROUP_CONCAT(d) AS f2 FROM t3 GROUP BY c, f1 ORDER BY f2;
10.3 0ca3aaa7
SELECT c, ( SELECT MIN (a) FROM t1 WHERE t3.c IN ( SELECT b FROM t2)) AS f1, GROUP_CONCAT(d) AS f2 FROM t3 GROUP BY c, f1 ORDER BY f2;
c f1 f2
2 NULL 2022-12-12
3 NULL 2023-12-12
EXPLAIN EXTENDED SELECT c, ( SELECT MIN (a) FROM t1 WHERE t3.c IN ( SELECT b FROM t2)) AS f1, GROUP_CONCAT(d) AS f2 FROM t3 GROUP BY c, f1 ORDER BY f2;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 2 100.00 Using temporary ; Using filesort
2 DEPENDENT SUBQUERY <subquery3> eq_ref distinct_key distinct_key 4 func 1 100.00
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join )
3 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 100.00
Warnings:
Note 1276 Field or reference 'test.t3.c' of SELECT #2 was resolved in SELECT #1
Note 1003 /* select#1 */ select `test`.`t3`.`c` AS `c`,<expr_cache><`test`.`t3`.`c`>(( /* select#2 */ select min (`test`.`t1`.`a`) from `test`.`t1` semi join (`test`.`t2`) where `test`.`t3`.`c` = `test`.`t2`.`b`)) AS `f1`,group_concat(`test`.`t3`.`d` separator ',' ) AS `f2` from `test`.`t3` group by `test`.`t3`.`c`,<expr_cache><`test`.`t3`.`c`>(( /* select#2 */ select min (`test`.`t1`.`a`) from `test`.`t1` semi join (`test`.`t2`) where `test`.`t3`.`c` = `test`.`t2`.`b`)) order by group_concat(`test`.`t3`.`d` separator ',' )
Expected result is
c f1 f2
2 8 2022-12-12
3 NULL 2023-12-12
On 10.3 it can be achieved with materialization=off .
Reproducible with at least MyISAM and InnoDB.
Reproducible on 5.5 (and materialization=off doesn't seem to help there).
Not reproducible on MySQL (5.6, 5.7, 8.0).
On bb-11.0 (a.k.a improved selectivity tree MDEV-26974 ) the plan with default settings is different and the result is correct, but the wrong one can still be triggered with firstmatch=off .
There are no comments yet on this issue.
{"report":{"fcp":1096.7999997138977,"ttfb":319.19999980926514,"pageVisibility":"visible","entityId":117952,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"92e188f4-cb27-4d11-9449-9c8499c6d44b","navigationType":0,"readyForUser":1192.5999999046326,"redirectCount":0,"resourceLoadedEnd":1347.5999999046326,"resourceLoadedStart":329.09999990463257,"resourceTiming":[{"duration":132.69999980926514,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":329.09999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":329.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":461.7999997138977,"responseStart":0,"secureConnectionStart":0},{"duration":132.59999990463257,"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":329.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":329.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":462.09999990463257,"responseStart":0,"secureConnectionStart":0},{"duration":172.69999980926514,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":329.69999980926514,"connectEnd":329.69999980926514,"connectStart":329.69999980926514,"domainLookupEnd":329.69999980926514,"domainLookupStart":329.69999980926514,"fetchStart":329.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":329.69999980926514,"responseEnd":502.3999996185303,"responseStart":502.3999996185303,"secureConnectionStart":329.69999980926514},{"duration":251.5,"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":329.8999996185303,"connectEnd":329.8999996185303,"connectStart":329.8999996185303,"domainLookupEnd":329.8999996185303,"domainLookupStart":329.8999996185303,"fetchStart":329.8999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":329.8999996185303,"responseEnd":581.3999996185303,"responseStart":581.3999996185303,"secureConnectionStart":329.8999996185303},{"duration":254.90000009536743,"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":330.19999980926514,"connectEnd":330.19999980926514,"connectStart":330.19999980926514,"domainLookupEnd":330.19999980926514,"domainLookupStart":330.19999980926514,"fetchStart":330.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":330.19999980926514,"responseEnd":585.0999999046326,"responseStart":585.0999999046326,"secureConnectionStart":330.19999980926514},{"duration":278.40000009536743,"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":330.7999997138977,"connectEnd":330.7999997138977,"connectStart":330.7999997138977,"domainLookupEnd":330.7999997138977,"domainLookupStart":330.7999997138977,"fetchStart":330.7999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":330.7999997138977,"responseEnd":609.1999998092651,"responseStart":609.1999998092651,"secureConnectionStart":330.7999997138977},{"duration":282.09999990463257,"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":331,"connectEnd":331,"connectStart":331,"domainLookupEnd":331,"domainLookupStart":331,"fetchStart":331,"redirectEnd":0,"redirectStart":0,"requestStart":331,"responseEnd":613.0999999046326,"responseStart":613.0999999046326,"secureConnectionStart":331},{"duration":351.40000009536743,"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":331.09999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":331.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":682.5,"responseStart":0,"secureConnectionStart":0},{"duration":282.30000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":331.2999997138977,"connectEnd":331.2999997138977,"connectStart":331.2999997138977,"domainLookupEnd":331.2999997138977,"domainLookupStart":331.2999997138977,"fetchStart":331.2999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":331.2999997138977,"responseEnd":613.5999999046326,"responseStart":613.5999999046326,"secureConnectionStart":331.2999997138977},{"duration":351.19999980926514,"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":331.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":331.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":682.6999998092651,"responseStart":0,"secureConnectionStart":0},{"duration":296.5,"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":331.59999990463257,"connectEnd":331.59999990463257,"connectStart":331.59999990463257,"domainLookupEnd":331.59999990463257,"domainLookupStart":331.59999990463257,"fetchStart":331.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":331.59999990463257,"responseEnd":628.0999999046326,"responseStart":628.0999999046326,"secureConnectionStart":331.59999990463257},{"duration":633,"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":332.3999996185303,"connectEnd":332.3999996185303,"connectStart":332.3999996185303,"domainLookupEnd":332.3999996185303,"domainLookupStart":332.3999996185303,"fetchStart":332.3999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":332.3999996185303,"responseEnd":965.3999996185303,"responseStart":965.3999996185303,"secureConnectionStart":332.3999996185303},{"duration":1006.3999996185303,"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":338.5,"connectEnd":338.5,"connectStart":338.5,"domainLookupEnd":338.5,"domainLookupStart":338.5,"fetchStart":338.5,"redirectEnd":0,"redirectStart":0,"requestStart":338.5,"responseEnd":1344.8999996185303,"responseStart":1344.8999996185303,"secureConnectionStart":338.5},{"duration":258.69999980926514,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":713.5999999046326,"connectEnd":713.5999999046326,"connectStart":713.5999999046326,"domainLookupEnd":713.5999999046326,"domainLookupStart":713.5999999046326,"fetchStart":713.5999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":713.5999999046326,"responseEnd":972.2999997138977,"responseStart":972.2999997138977,"secureConnectionStart":713.5999999046326},{"duration":325.80000019073486,"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":1021.7999997138977,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1021.7999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1347.5999999046326,"responseStart":0,"secureConnectionStart":0},{"duration":365.19999980926514,"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":1022.6999998092651,"connectEnd":1022.6999998092651,"connectStart":1022.6999998092651,"domainLookupEnd":1022.6999998092651,"domainLookupStart":1022.6999998092651,"fetchStart":1022.6999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":1022.6999998092651,"responseEnd":1387.8999996185303,"responseStart":1387.8999996185303,"secureConnectionStart":1022.6999998092651},{"duration":369.69999980926514,"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":1023.1999998092651,"connectEnd":1023.1999998092651,"connectStart":1023.1999998092651,"domainLookupEnd":1023.1999998092651,"domainLookupStart":1023.1999998092651,"fetchStart":1023.1999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":1023.1999998092651,"responseEnd":1392.8999996185303,"responseStart":1392.8999996185303,"secureConnectionStart":1023.1999998092651}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":149,"responseStart":319,"responseEnd":331,"domLoading":325,"domInteractive":1366,"domContentLoadedEventStart":1366,"domContentLoadedEventEnd":1413,"domComplete":1551,"loadEventStart":1551,"loadEventEnd":1552,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1348.6999998092651},{"name":"bigPipe.sidebar-id.end","time":1349.6999998092651},{"name":"bigPipe.activity-panel-pipe-id.start","time":1349.8999996185303},{"name":"bigPipe.activity-panel-pipe-id.end","time":1350.2999997138977},{"name":"activityTabFullyLoaded","time":1430.5}],"measures":[],"correlationId":"2a1cc717483104","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":107,"dbReadsTimeInMs":13,"dbConnsTimeInMs":26,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}