Type:
Bug
Priority:
Major
Resolution:
Fixed
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) , 11.0(EOL)
For the following query with SELECT:
select *
from v1,t3
where
v1.c2 = t3.c2 and
v1.c2 in ( select max (c2) from t2 where c3 = v1.c3)
and v1.c1 < 10 and
v1.c1 in ( select c1 from v2);
EXPLAIN EXTENDED produces messages:
Warnings:
Note 1276 Field or reference 'v1.c3' of SELECT #2 was resolved in SELECT #1
Note 1003 /* select#1 */ select `test`.`t1`.`c1` AS `c1`,`test`.`t1`.`c2` AS `c2`,`test`.`t1`.`c3` AS `c3`,`test`.`t3`.`c1` AS `c1`,`test`.`t3`.`c2` AS `c2`,`test`.`t3`.`c3` AS `c3` from `test`.`t1` semi join (`test`.`t2`) join `test`.`t3` where `test`.`t1`.`c2` = 2 and `test`.`t3`.`c2` = 2 and `test`.`t2`.`c2` = 2 and <expr_cache><2,`test`.`t1`.`c3`>(<in_optimizer>(2,<exists>( /* select#2 */ select max (`test`.`t2`.`c2`) from `test`.`t2` where `test`.`t2`.`c3` = `test`.`t1`.`c3` having <cache>(`test`.`t1`.`c2`) = <ref_null_helper>( max (`test`.`t2`.`c2`))))) and `test`.`t1`.`c1` < 10
For the queries with DELETE and UPDATE based on previous SELECT:
delete
from v1
using v1,t3
where
v1.c2 = t3.c2 and
v1.c2 in ( select max (c2) from t2 where c3 = v1.c3)
and v1.c1 < 10 and
exists ( select 'X' from v2 where c1 = v1.c1);
update v1,t3
set v1.c1 = 15
where
v1.c2 = t3.c2 and
v1.c2 in ( select max (c2) from t2 where c3 = v1.c3)
and v1.c1 < 10 and
exists ( select 'X' from v2 where c1 = v1.c1);
EXPLAIN EXTENDED does not produce message with query after optimization :
Warnings:
Note 1276 Field or reference 'v1.c3' of SELECT #2 was resolved in SELECT #1
Note 1276 Field or reference 'v1.c1' of SELECT #3 was resolved in SELECT #1
Problem with plan in this case will be fixed in MDEV-30538
MTR test case:
--source include/have_innodb.inc
create table t1 (c1 integer , c2 integer , c3 integer ) engine=innodb;
insert into t1(c1,c2,c3)
values (1,1,1),(1,2,2),(1,3,3),
(2,1,4),(2,2,5),(2,3,6),
(2,4,7),(2,5,8);
create view v1 as select * from t1 where c2=2;
create index t1_c2 on t1 (c2);
analyze table t1 persistent for all ;
create table t2 (c1 integer , c2 integer , c3 integer ) engine=innodb;
insert into t2(c1,c2,c3)
values (1,1,1),(1,2,2),(1,3,3),
(2,1,4),(2,2,5),(2,3,6),
(2,4,7),(2,5,8);
create view v2 as select * from t2 where c2=2;
create index t2_c2 on t2 (c2);
analyze table t2 persistent for all ;
create table t3 (c1 integer , c2 integer , c3 integer ) engine=innodb;
insert into t3(c1,c2,c3)
values (1,1,1),(1,2,2),(1,3,3),
(2,1,4),(2,2,5),(2,3,6),
(2,4,7),(2,5,8);
analyze table t3 persistent for all ;
EXPLAIN EXTENDED
select *
from v1,t3
where
v1.c2 = t3.c2 and
v1.c2 in ( select max (c2) from t2 where c3 = v1.c3)
and v1.c1 < 10 and
v1.c1 in ( select c1 from v2);
EXPLAIN EXTENDED
delete
from v1
using v1,t3
where
v1.c2 = t3.c2 and
v1.c2 in ( select max (c2) from t2 where c3 = v1.c3)
and v1.c1 < 10 and
exists ( select 'X' from v2 where c1 = v1.c1);
EXPLAIN EXTENDED
update v1,t3
set v1.c1 = 15
where
v1.c2 = t3.c2 and
v1.c2 in ( select max (c2) from t2 where c3 = v1.c3)
and v1.c1 < 10 and
exists ( select 'X' from v2 where c1 = v1.c1);
drop view v1, v2;
drop table t1, t2, t3;
causes
MDEV-31224
Crash with EXPLAIN EXTENDED for multi-table update of system table
Closed
{"report":{"fcp":1748.3999998569489,"ttfb":638.8999998569489,"pageVisibility":"visible","entityId":118851,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"338242a9-f343-4a2d-8fa6-b66fbe2675d4","navigationType":0,"readyForUser":1920.5,"redirectCount":0,"resourceLoadedEnd":2069.5999999046326,"resourceLoadedStart":645.7000000476837,"resourceTiming":[{"duration":399.5,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":645.7000000476837,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":645.7000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1045.2000000476837,"responseStart":0,"secureConnectionStart":0},{"duration":399.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":646,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":646,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1045.5999999046326,"responseStart":0,"secureConnectionStart":0},{"duration":475.2000000476837,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":646.2999999523163,"connectEnd":646.2999999523163,"connectStart":646.2999999523163,"domainLookupEnd":646.2999999523163,"domainLookupStart":646.2999999523163,"fetchStart":646.2999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":646.2999999523163,"responseEnd":1121.5,"responseStart":1121.5,"secureConnectionStart":646.2999999523163},{"duration":536.2999999523163,"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":646.5,"connectEnd":646.5,"connectStart":646.5,"domainLookupEnd":646.5,"domainLookupStart":646.5,"fetchStart":646.5,"redirectEnd":0,"redirectStart":0,"requestStart":646.5,"responseEnd":1182.7999999523163,"responseStart":1182.7999999523163,"secureConnectionStart":646.5},{"duration":553.0999999046326,"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":646.7000000476837,"connectEnd":646.7000000476837,"connectStart":646.7000000476837,"domainLookupEnd":646.7000000476837,"domainLookupStart":646.7000000476837,"fetchStart":646.7000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":646.7000000476837,"responseEnd":1199.7999999523163,"responseStart":1199.7999999523163,"secureConnectionStart":646.7000000476837},{"duration":553.5999999046326,"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":646.7999999523163,"connectEnd":646.7999999523163,"connectStart":646.7999999523163,"domainLookupEnd":646.7999999523163,"domainLookupStart":646.7999999523163,"fetchStart":646.7999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":646.7999999523163,"responseEnd":1200.3999998569489,"responseStart":1200.3999998569489,"secureConnectionStart":646.7999999523163},{"duration":554,"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":647,"connectEnd":647,"connectStart":647,"domainLookupEnd":647,"domainLookupStart":647,"fetchStart":647,"redirectEnd":0,"redirectStart":0,"requestStart":647,"responseEnd":1201,"responseStart":1201,"secureConnectionStart":647},{"duration":668.0999999046326,"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":647.2000000476837,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":647.2000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1315.2999999523163,"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":647.2000000476837,"connectEnd":647.2000000476837,"connectStart":647.2000000476837,"domainLookupEnd":647.2000000476837,"domainLookupStart":647.2000000476837,"fetchStart":647.2000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":647.2000000476837,"responseEnd":1201.7000000476837,"responseStart":1201.7000000476837,"secureConnectionStart":647.2000000476837},{"duration":668.1000001430511,"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":647.3999998569489,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":647.3999998569489,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1315.5,"responseStart":0,"secureConnectionStart":0},{"duration":554.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":647.7000000476837,"connectEnd":647.7000000476837,"connectStart":647.7000000476837,"domainLookupEnd":647.7000000476837,"domainLookupStart":647.7000000476837,"fetchStart":647.7000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":647.7000000476837,"responseEnd":1202.5,"responseStart":1202.5,"secureConnectionStart":647.7000000476837},{"duration":1052.2999999523163,"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":663.0999999046326,"connectEnd":663.0999999046326,"connectStart":663.0999999046326,"domainLookupEnd":663.0999999046326,"domainLookupStart":663.0999999046326,"fetchStart":663.0999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":663.0999999046326,"responseEnd":1715.3999998569489,"responseStart":1715.2999999523163,"secureConnectionStart":663.0999999046326},{"duration":1406.2999999523163,"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":663.2999999523163,"connectEnd":663.2999999523163,"connectStart":663.2999999523163,"domainLookupEnd":663.2999999523163,"domainLookupStart":663.2999999523163,"fetchStart":663.2999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":663.2999999523163,"responseEnd":2069.5999999046326,"responseStart":2069.5999999046326,"secureConnectionStart":663.2999999523163},{"duration":478.5,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":1358,"connectEnd":1358,"connectStart":1358,"domainLookupEnd":1358,"domainLookupStart":1358,"fetchStart":1358,"redirectEnd":0,"redirectStart":0,"requestStart":1358,"responseEnd":1836.5,"responseStart":1836.5,"secureConnectionStart":1358},{"duration":365.5,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":1731.2000000476837,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1731.2000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":2096.7000000476837,"responseStart":0,"secureConnectionStart":0},{"duration":178.10000014305115,"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":2020.8999998569489,"connectEnd":2020.8999998569489,"connectStart":2020.8999998569489,"domainLookupEnd":2020.8999998569489,"domainLookupStart":2020.8999998569489,"fetchStart":2020.8999998569489,"redirectEnd":0,"redirectStart":0,"requestStart":2020.8999998569489,"responseEnd":2199,"responseStart":2199,"secureConnectionStart":2020.8999998569489}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":456,"responseStart":639,"responseEnd":663,"domLoading":644,"domInteractive":2097,"domContentLoadedEventStart":2097,"domContentLoadedEventEnd":2159,"domComplete":2901,"loadEventStart":2901,"loadEventEnd":2905,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":2076.7999999523163},{"name":"bigPipe.sidebar-id.end","time":2077.7000000476837},{"name":"bigPipe.activity-panel-pipe-id.start","time":2077.899999856949},{"name":"bigPipe.activity-panel-pipe-id.end","time":2080.5999999046326},{"name":"activityTabFullyLoaded","time":2206.2000000476837}],"measures":[],"correlationId":"aa71220dd67e4b","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":107,"dbReadsTimeInMs":13,"dbConnsTimeInMs":22,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}