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":894,"ttfb":292.5,"pageVisibility":"visible","entityId":118851,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"13f17f0c-b435-49e8-b8a0-4737ee09cb5b","navigationType":0,"readyForUser":1000.5,"redirectCount":0,"resourceLoadedEnd":1448.5999999046326,"resourceLoadedStart":297.80000019073486,"resourceTiming":[{"duration":134.7999997138977,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bv2/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":297.80000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":297.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":432.59999990463257,"responseStart":0,"secureConnectionStart":0},{"duration":134.90000009536743,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2bv2/820016/12ta74/2380add21a9a1006587582385952de73/_/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","startTime":298,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":298,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":432.90000009536743,"responseStart":0,"secureConnectionStart":0},{"duration":144.2999997138977,"initiatorType":"script","name":"https://jira.mariadb.org/s/e9b27a47da5fb0f74a35acd57e9847fb-CDN/lu2bv2/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":298.2000002861023,"connectEnd":298.2000002861023,"connectStart":298.2000002861023,"domainLookupEnd":298.2000002861023,"domainLookupStart":298.2000002861023,"fetchStart":298.2000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":298.2000002861023,"responseEnd":442.5,"responseStart":442.5,"secureConnectionStart":298.2000002861023},{"duration":230.80000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/s/c32eb0da7ad9831253f8397e6cc26afd-CDN/lu2bv2/820016/12ta74/2380add21a9a1006587582385952de73/_/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","startTime":298.40000009536743,"connectEnd":298.40000009536743,"connectStart":298.40000009536743,"domainLookupEnd":298.40000009536743,"domainLookupStart":298.40000009536743,"fetchStart":298.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":298.40000009536743,"responseEnd":529.2000002861023,"responseStart":529.2000002861023,"secureConnectionStart":298.40000009536743},{"duration":234.30000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/s/bc0bcb146314416123c992714ee00ff7-CDN/lu2bv2/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":298.59999990463257,"connectEnd":298.59999990463257,"connectStart":298.59999990463257,"domainLookupEnd":298.59999990463257,"domainLookupStart":298.59999990463257,"fetchStart":298.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":298.59999990463257,"responseEnd":532.9000000953674,"responseStart":532.9000000953674,"secureConnectionStart":298.59999990463257},{"duration":234.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":298.80000019073486,"connectEnd":298.80000019073486,"connectStart":298.80000019073486,"domainLookupEnd":298.80000019073486,"domainLookupStart":298.80000019073486,"fetchStart":298.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":298.80000019073486,"responseEnd":533.3000001907349,"responseStart":533.3000001907349,"secureConnectionStart":298.80000019073486},{"duration":234.90000009536743,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":298.90000009536743,"connectEnd":298.90000009536743,"connectStart":298.90000009536743,"domainLookupEnd":298.90000009536743,"domainLookupStart":298.90000009536743,"fetchStart":298.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":298.90000009536743,"responseEnd":533.8000001907349,"responseStart":533.8000001907349,"secureConnectionStart":298.90000009536743},{"duration":285.6000003814697,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2bv2/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":299.09999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":299.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":584.7000002861023,"responseStart":0,"secureConnectionStart":0},{"duration":235.5,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":299.2000002861023,"connectEnd":299.2000002861023,"connectStart":299.2000002861023,"domainLookupEnd":299.2000002861023,"domainLookupStart":299.2000002861023,"fetchStart":299.2000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":299.2000002861023,"responseEnd":534.7000002861023,"responseStart":534.7000002861023,"secureConnectionStart":299.2000002861023},{"duration":285.30000019073486,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2bv2/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":299.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":299.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":584.8000001907349,"responseStart":0,"secureConnectionStart":0},{"duration":235.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/719848dd97ebe0663199f49a3936487a-CDN/lu2bv2/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":299.7000002861023,"connectEnd":299.7000002861023,"connectStart":299.7000002861023,"domainLookupEnd":299.7000002861023,"domainLookupStart":299.7000002861023,"fetchStart":299.7000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":299.7000002861023,"responseEnd":535.2000002861023,"responseStart":535.2000002861023,"secureConnectionStart":299.7000002861023},{"duration":354.90000009536743,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":306,"connectEnd":306,"connectStart":306,"domainLookupEnd":306,"domainLookupStart":306,"fetchStart":306,"redirectEnd":0,"redirectStart":0,"requestStart":306,"responseEnd":660.9000000953674,"responseStart":660.8000001907349,"secureConnectionStart":306},{"duration":1142.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":306.09999990463257,"connectEnd":306.09999990463257,"connectStart":306.09999990463257,"domainLookupEnd":306.09999990463257,"domainLookupStart":306.09999990463257,"fetchStart":306.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":306.09999990463257,"responseEnd":1448.5999999046326,"responseStart":1448.5999999046326,"secureConnectionStart":306.09999990463257},{"duration":768.4000000953674,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":596.5999999046326,"connectEnd":596.5999999046326,"connectStart":596.5999999046326,"domainLookupEnd":596.5999999046326,"domainLookupStart":596.5999999046326,"fetchStart":596.5999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":596.5999999046326,"responseEnd":1365,"responseStart":1365,"secureConnectionStart":596.5999999046326}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":99,"responseStart":293,"responseEnd":306,"domLoading":296,"domInteractive":1466,"domContentLoadedEventStart":1466,"domContentLoadedEventEnd":1511,"domComplete":3161,"loadEventStart":3161,"loadEventEnd":3163,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1450.5},{"name":"bigPipe.sidebar-id.end","time":1451.3000001907349},{"name":"bigPipe.activity-panel-pipe-id.start","time":1451.5},{"name":"bigPipe.activity-panel-pipe-id.end","time":1453.7000002861023},{"name":"activityTabFullyLoaded","time":1518.3000001907349}],"measures":[],"correlationId":"b7185227ed9e0f","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":113,"dbReadsTimeInMs":13,"dbConnsTimeInMs":21,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}