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":1520.5,"ttfb":628.6999998092651,"pageVisibility":"visible","entityId":117952,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"51f7ecdc-c897-45e6-aff2-0c608650f70c","navigationType":0,"readyForUser":1615.5,"redirectCount":0,"resourceLoadedEnd":1726.5,"resourceLoadedStart":634.7999997138977,"resourceTiming":[{"duration":210.40000009536743,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":634.7999997138977,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":634.7999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":845.1999998092651,"responseStart":0,"secureConnectionStart":0},{"duration":210.69999980926514,"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":635,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":635,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":845.6999998092651,"responseStart":0,"secureConnectionStart":0},{"duration":263.40000009536743,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":635.2999997138977,"connectEnd":635.2999997138977,"connectStart":635.2999997138977,"domainLookupEnd":635.2999997138977,"domainLookupStart":635.2999997138977,"fetchStart":635.2999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":635.2999997138977,"responseEnd":898.6999998092651,"responseStart":898.6999998092651,"secureConnectionStart":635.2999997138977},{"duration":550.0999999046326,"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":635.5,"connectEnd":635.5,"connectStart":635.5,"domainLookupEnd":635.5,"domainLookupStart":635.5,"fetchStart":635.5,"redirectEnd":0,"redirectStart":0,"requestStart":635.5,"responseEnd":1185.5999999046326,"responseStart":1185.5999999046326,"secureConnectionStart":635.5},{"duration":553.8000001907349,"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":635.6999998092651,"connectEnd":635.6999998092651,"connectStart":635.6999998092651,"domainLookupEnd":635.6999998092651,"domainLookupStart":635.6999998092651,"fetchStart":635.6999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":635.6999998092651,"responseEnd":1189.5,"responseStart":1189.5,"secureConnectionStart":635.6999998092651},{"duration":554.1999998092651,"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":635.9000000953674,"connectEnd":635.9000000953674,"connectStart":635.9000000953674,"domainLookupEnd":635.9000000953674,"domainLookupStart":635.9000000953674,"fetchStart":635.9000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":635.9000000953674,"responseEnd":1190.0999999046326,"responseStart":1190.0999999046326,"secureConnectionStart":635.9000000953674},{"duration":554.4000000953674,"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":636,"connectEnd":636,"connectStart":636,"domainLookupEnd":636,"domainLookupStart":636,"fetchStart":636,"redirectEnd":0,"redirectStart":0,"requestStart":636,"responseEnd":1190.4000000953674,"responseStart":1190.4000000953674,"secureConnectionStart":636},{"duration":555,"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":636.2999997138977,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":636.2999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1191.2999997138977,"responseStart":0,"secureConnectionStart":0},{"duration":554.5,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":636.4000000953674,"connectEnd":636.4000000953674,"connectStart":636.4000000953674,"domainLookupEnd":636.4000000953674,"domainLookupStart":636.4000000953674,"fetchStart":636.4000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":636.4000000953674,"responseEnd":1190.9000000953674,"responseStart":1190.7999997138977,"secureConnectionStart":636.4000000953674},{"duration":555,"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":636.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":636.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1191.5,"responseStart":0,"secureConnectionStart":0},{"duration":554.8000001907349,"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":636.6999998092651,"connectEnd":636.6999998092651,"connectStart":636.6999998092651,"domainLookupEnd":636.6999998092651,"domainLookupStart":636.6999998092651,"fetchStart":636.6999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":636.6999998092651,"responseEnd":1191.5,"responseStart":1191.5,"secureConnectionStart":636.6999998092651},{"duration":891.0999999046326,"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":637.5,"connectEnd":637.5,"connectStart":637.5,"domainLookupEnd":637.5,"domainLookupStart":637.5,"fetchStart":637.5,"redirectEnd":0,"redirectStart":0,"requestStart":637.5,"responseEnd":1528.5999999046326,"responseStart":1528.5999999046326,"secureConnectionStart":637.5},{"duration":1078.1999998092651,"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":637.5999999046326,"connectEnd":637.5999999046326,"connectStart":637.5999999046326,"domainLookupEnd":637.5999999046326,"domainLookupStart":637.5999999046326,"fetchStart":637.5999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":637.5999999046326,"responseEnd":1715.7999997138977,"responseStart":1715.7999997138977,"secureConnectionStart":637.5999999046326},{"duration":318.30000019073486,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":1049.7999997138977,"connectEnd":1049.7999997138977,"connectStart":1049.7999997138977,"domainLookupEnd":1049.7999997138977,"domainLookupStart":1049.7999997138977,"fetchStart":1049.7999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":1049.7999997138977,"responseEnd":1368.0999999046326,"responseStart":1368.0999999046326,"secureConnectionStart":1049.7999997138977},{"duration":249.90000009536743,"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":1463.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1463.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1713.4000000953674,"responseStart":0,"secureConnectionStart":0},{"duration":253.40000009536743,"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":1464.5,"connectEnd":1464.5,"connectStart":1464.5,"domainLookupEnd":1464.5,"domainLookupStart":1464.5,"fetchStart":1464.5,"redirectEnd":0,"redirectStart":0,"requestStart":1464.5,"responseEnd":1717.9000000953674,"responseStart":1717.9000000953674,"secureConnectionStart":1464.5},{"duration":261.59999990463257,"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":1464.9000000953674,"connectEnd":1464.9000000953674,"connectStart":1464.9000000953674,"domainLookupEnd":1464.9000000953674,"domainLookupStart":1464.9000000953674,"fetchStart":1464.9000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":1464.9000000953674,"responseEnd":1726.5,"responseStart":1726.5,"secureConnectionStart":1464.9000000953674},{"duration":219.5,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":1513.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1513.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1733,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":465,"responseStart":629,"responseEnd":630,"domLoading":632,"domInteractive":1734,"domContentLoadedEventStart":1734,"domContentLoadedEventEnd":1778,"domComplete":1962,"loadEventStart":1962,"loadEventEnd":1962,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1717.7999997138977},{"name":"bigPipe.sidebar-id.end","time":1718.5999999046326},{"name":"bigPipe.activity-panel-pipe-id.start","time":1718.9000000953674},{"name":"bigPipe.activity-panel-pipe-id.end","time":1719.2999997138977},{"name":"activityTabFullyLoaded","time":1785.4000000953674}],"measures":[],"correlationId":"7f37da214c897f","effectiveType":"4g","downlink":9.5,"rtt":0,"serverDuration":95,"dbReadsTimeInMs":11,"dbConnsTimeInMs":20,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}