-
Bug
-
-
Critical
-
Resolution:
Fixed
-
10.2(EOL), 10.3(EOL), 10.4(EOL), 10.5, 10.6, 10.7(EOL)
-
-
-
Here is the testcase (with totally synthetic data) :
CREATE TABLE t1 (
|
key1 varchar(30) NOT NULL,
|
col1 int(11) NOT NULL,
|
filler char(100)
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
insert into t1
|
select
|
seq, seq, seq
|
from seq_1_to_100000;
|
CREATE TABLE t10 (
|
key1 varchar(30) NOT NULL,
|
col1 int,
|
filler char(100),
|
PRIMARY KEY (key1)
|
) ENGINE=InnoDB CHARSET=utf8;
|
|
insert into t10
|
select
|
seq, seq, seq from seq_1_to_100000;
|
CREATE TABLE t11 (
|
key1 varchar(30) NOT NULL,
|
filler char(100),
|
PRIMARY KEY (key1)
|
) ENGINE=InnoDB CHARSET=utf8;
|
|
insert into t11
|
select
|
seq, seq from seq_1_to_100000;
|
explain
|
select * from t1 hist
|
where
|
hist.col1 NOT IN (SELECT tn.col1
|
FROM t10 tn JOIN t11 tms ON tms.key1 = tn.key1
|
WHERE
|
tn.key1 IN ('1','2','3','4','5','6','7','8','9','10')
|
) \G
|
explain update t1 hist
|
set filler='aaa'
|
WHERE
|
key1 IN ('1','2','3','4','5','6','7','8','9','10') AND
|
hist.col1 NOT IN (SELECT tn.col1
|
FROM t10 tn JOIN t11 tms ON tms.key1 = tn.key1
|
WHERE tn.key1 IN ('1','2','3','4','5','6','7','8','9','10')
|
) \G
|
EXPLAIN output for SELECT:
*************************** 1. row ***************************
|
id: 1
|
select_type: PRIMARY
|
table: hist
|
type: ALL
|
possible_keys: NULL
|
key: NULL
|
key_len: NULL
|
ref: NULL
|
rows: 99268
|
Extra: Using where
|
*************************** 2. row ***************************
|
id: 2
|
select_type: MATERIALIZED
|
table: tms
|
type: range
|
possible_keys: PRIMARY
|
key: PRIMARY
|
key_len: 92
|
ref: NULL
|
rows: 10
|
Extra: Using where; Using index
|
*************************** 3. row ***************************
|
id: 2
|
select_type: MATERIALIZED
|
table: tn
|
type: eq_ref
|
possible_keys: PRIMARY
|
key: PRIMARY
|
key_len: 92
|
ref: j5.tms.key1
|
rows: 1
|
Extra:
|
Note that table tms uses range access.
EXPLAIN output for the UPDATE:
*************************** 1. row ***************************
|
id: 1
|
select_type: PRIMARY
|
table: hist
|
type: ALL
|
possible_keys: NULL
|
key: NULL
|
key_len: NULL
|
ref: NULL
|
rows: 99268
|
Extra: Using where
|
*************************** 2. row ***************************
|
id: 2
|
select_type: DEPENDENT SUBQUERY
|
table: tms
|
type: index
|
possible_keys: PRIMARY
|
key: PRIMARY
|
key_len: 92
|
ref: NULL
|
rows: 85462
|
Extra: Using where; Using index
|
*************************** 3. row ***************************
|
id: 2
|
select_type: DEPENDENT SUBQUERY
|
table: tn
|
type: eq_ref
|
possible_keys: PRIMARY
|
key: PRIMARY
|
key_len: 92
|
ref: j5.tms.key1
|
rows: 1
|
Extra: Using where
|
3 rows in set (0.001 sec)
|
Now, table "tms" uses full index scan even if it could easily use the same range access.
Note: the issue goes away if the tables have 10K rows instead of 100K.
- relates to
-
MDEV-22415
Single table UPDATE/DELETE doesn't use non-semijoin Materialization
-
-
Closed
{"report":{"fcp":944.2000000000698,"ttfb":258.70000000006985,"pageVisibility":"visible","entityId":86096,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"51149d57-dd15-4349-9ab9-8aa000f8db36","navigationType":0,"readyForUser":1050.4000000000233,"redirectCount":0,"resourceLoadedEnd":1121.2000000000698,"resourceLoadedStart":263.5,"resourceTiming":[{"duration":287.5,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bv2/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":263.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":263.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":551,"responseStart":0,"secureConnectionStart":0},{"duration":287.4000000000233,"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":263.80000000004657,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":263.80000000004657,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":551.2000000000698,"responseStart":0,"secureConnectionStart":0},{"duration":296.19999999995343,"initiatorType":"script","name":"https://jira.mariadb.org/s/e9b27a47da5fb0f74a35acd57e9847fb-CDN/lu2bv2/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":263.9000000000233,"connectEnd":263.9000000000233,"connectStart":263.9000000000233,"domainLookupEnd":263.9000000000233,"domainLookupStart":263.9000000000233,"fetchStart":263.9000000000233,"redirectEnd":0,"redirectStart":0,"requestStart":263.9000000000233,"responseEnd":560.0999999999767,"responseStart":560.0999999999767,"secureConnectionStart":263.9000000000233},{"duration":321.20000000006985,"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":264.0999999999767,"connectEnd":264.0999999999767,"connectStart":264.0999999999767,"domainLookupEnd":264.0999999999767,"domainLookupStart":264.0999999999767,"fetchStart":264.0999999999767,"redirectEnd":0,"redirectStart":0,"requestStart":264.0999999999767,"responseEnd":585.3000000000466,"responseStart":585.3000000000466,"secureConnectionStart":264.0999999999767},{"duration":324.5999999999767,"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":264.4000000000233,"connectEnd":264.4000000000233,"connectStart":264.4000000000233,"domainLookupEnd":264.4000000000233,"domainLookupStart":264.4000000000233,"fetchStart":264.4000000000233,"redirectEnd":0,"redirectStart":0,"requestStart":264.4000000000233,"responseEnd":589,"responseStart":589,"secureConnectionStart":264.4000000000233},{"duration":324.9000000000233,"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":264.5,"connectEnd":264.5,"connectStart":264.5,"domainLookupEnd":264.5,"domainLookupStart":264.5,"fetchStart":264.5,"redirectEnd":0,"redirectStart":0,"requestStart":264.5,"responseEnd":589.4000000000233,"responseStart":589.4000000000233,"secureConnectionStart":264.5},{"duration":325,"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":264.70000000006985,"connectEnd":264.70000000006985,"connectStart":264.70000000006985,"domainLookupEnd":264.70000000006985,"domainLookupStart":264.70000000006985,"fetchStart":264.70000000006985,"redirectEnd":0,"redirectStart":0,"requestStart":264.70000000006985,"responseEnd":589.7000000000698,"responseStart":589.7000000000698,"secureConnectionStart":264.70000000006985},{"duration":326,"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":264.9000000000233,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":264.9000000000233,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":590.9000000000233,"responseStart":0,"secureConnectionStart":0},{"duration":325,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":265.0999999999767,"connectEnd":265.0999999999767,"connectStart":265.0999999999767,"domainLookupEnd":265.0999999999767,"domainLookupStart":265.0999999999767,"fetchStart":265.0999999999767,"redirectEnd":0,"redirectStart":0,"requestStart":265.0999999999767,"responseEnd":590.0999999999767,"responseStart":590.0999999999767,"secureConnectionStart":265.0999999999767},{"duration":325.69999999995343,"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":265.20000000006985,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":265.20000000006985,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":590.9000000000233,"responseStart":0,"secureConnectionStart":0},{"duration":325.19999999995343,"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":265.4000000000233,"connectEnd":265.4000000000233,"connectStart":265.4000000000233,"domainLookupEnd":265.4000000000233,"domainLookupStart":265.4000000000233,"fetchStart":265.4000000000233,"redirectEnd":0,"redirectStart":0,"requestStart":265.4000000000233,"responseEnd":590.5999999999767,"responseStart":590.5999999999767,"secureConnectionStart":265.4000000000233},{"duration":638.5999999999767,"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":270.80000000004657,"connectEnd":270.80000000004657,"connectStart":270.80000000004657,"domainLookupEnd":270.80000000004657,"domainLookupStart":270.80000000004657,"fetchStart":270.80000000004657,"redirectEnd":0,"redirectStart":0,"requestStart":270.80000000004657,"responseEnd":909.4000000000233,"responseStart":909.4000000000233,"secureConnectionStart":270.80000000004657},{"duration":850.3000000000466,"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":270.9000000000233,"connectEnd":270.9000000000233,"connectStart":270.9000000000233,"domainLookupEnd":270.9000000000233,"domainLookupStart":270.9000000000233,"fetchStart":270.9000000000233,"redirectEnd":0,"redirectStart":0,"requestStart":270.9000000000233,"responseEnd":1121.2000000000698,"responseStart":1121.2000000000698,"secureConnectionStart":270.9000000000233},{"duration":229.90000000002328,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":769.5,"connectEnd":769.5,"connectStart":769.5,"domainLookupEnd":769.5,"domainLookupStart":769.5,"fetchStart":769.5,"redirectEnd":0,"redirectStart":0,"requestStart":769.5,"responseEnd":999.4000000000233,"responseStart":999.4000000000233,"secureConnectionStart":769.5}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":80,"responseStart":259,"responseEnd":268,"domLoading":261,"domInteractive":1157,"domContentLoadedEventStart":1157,"domContentLoadedEventEnd":1198,"domComplete":2548,"loadEventStart":2548,"loadEventEnd":2549,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1139.9000000000233},{"name":"bigPipe.sidebar-id.end","time":1140.5999999999767},{"name":"bigPipe.activity-panel-pipe-id.start","time":1140.7000000000698},{"name":"bigPipe.activity-panel-pipe-id.end","time":1142.9000000000233},{"name":"activityTabFullyLoaded","time":1205.5}],"measures":[],"correlationId":"3366733a656b63","effectiveType":"4g","downlink":9.9,"rtt":0,"serverDuration":96,"dbReadsTimeInMs":10,"dbConnsTimeInMs":18,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}