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
Possibly the test case can be reduced further, I kept the structures close to the original dbt3, just removed unnecessary columns and rows.
CREATE DATABASE dbt3;
USE dbt3;
CREATE TABLE `customer` (
`c_nationkey` int (11) DEFAULT NULL ,
KEY `i_c_nationkey` (`c_nationkey`)
) ENGINE=MyISAM;
INSERT INTO `customer` VALUES (18),(17),(8);
CREATE TABLE `lineitem` (
`l_orderkey` int (11) NOT NULL DEFAULT 0,
`l_partkey` int (11) DEFAULT NULL ,
`l_linenumber` int (11) NOT NULL DEFAULT 0,
PRIMARY KEY (`l_orderkey`,`l_linenumber`)
) ENGINE=MyISAM;
INSERT INTO `lineitem` VALUES (1,1,1),(1,1,4),(3,1,1);
CREATE TABLE `nation` (
`n_nationkey` int (11) NOT NULL ,
`n_regionkey` int (11) DEFAULT NULL ,
PRIMARY KEY (`n_nationkey`),
KEY `i_n_regionkey` (`n_regionkey`)
) ENGINE=MyISAM;
INSERT INTO `nation` VALUES (17,1),(24,1);
CREATE TABLE `orders` (
`o_orderkey` int (11) NOT NULL ,
`o_totalprice` double DEFAULT NULL ,
PRIMARY KEY (`o_orderkey`)
) ENGINE=MyISAM;
INSERT INTO `orders` VALUES
(1,125405.67),(2,36349.29),(3,150931.2),(4,28568.05),(5,80601.73);
CREATE TABLE `partsupp` (
`ps_partkey` int (11) NOT NULL DEFAULT 0,
`ps_suppkey` int (11) NOT NULL DEFAULT 0,
PRIMARY KEY (`ps_partkey`,`ps_suppkey`)
) ENGINE=MyISAM;
INSERT INTO `partsupp` VALUES (1,1),(17,1);
CREATE TABLE `region` (
`r_regionkey` int (11) NOT NULL ,
PRIMARY KEY (`r_regionkey`)
) ENGINE=MyISAM;
INSERT INTO `region` VALUES (0),(1),(2),(3),(4);
CREATE TABLE `supplier` (
`s_suppkey` int (11) NOT NULL ,
`s_nationkey` int (11) DEFAULT NULL ,
`s_acctbal` double DEFAULT NULL ,
PRIMARY KEY (`s_suppkey`)
) ENGINE=MyISAM;
INSERT INTO `supplier` VALUES (1,17,5755.94);
SELECT n_nationkey FROM nation LEFT JOIN region ON ( r_regionkey = n_regionkey ) JOIN supplier ON ( s_nationkey = n_nationkey ) JOIN partsupp ON ( s_suppkey = ps_suppkey ) JOIN lineitem ON ( ps_partkey = l_partkey ) JOIN orders ON ( l_orderkey = o_orderkey ) JOIN customer WHERE o_totalprice = 151 OR c_nationkey = s_nationkey AND s_acctbal > 187;
CREATE TABLE t (a INT );
INSERT INTO t VALUES (1),(17),(2),(17);
SELECT * FROM t WHERE a IN (
SELECT n_nationkey FROM nation LEFT JOIN region ON ( r_regionkey = n_regionkey ) JOIN supplier ON ( s_nationkey = n_nationkey ) JOIN partsupp ON ( s_suppkey = ps_suppkey ) JOIN lineitem ON ( ps_partkey = l_partkey ) JOIN orders ON ( l_orderkey = o_orderkey ) JOIN customer WHERE o_totalprice = 151 OR c_nationkey = s_nationkey AND s_acctbal > 187
);
# Cleanup
DROP DATABASE dbt3;
SELECT n_nationkey FROM nation LEFT JOIN region ON ( r_regionkey = n_regionkey ) JOIN supplier ON ( s_nationkey = n_nationkey ) JOIN partsupp ON ( s_suppkey = ps_suppkey ) JOIN lineitem ON ( ps_partkey = l_partkey ) JOIN orders ON ( l_orderkey = o_orderkey ) JOIN customer WHERE o_totalprice = 151 OR c_nationkey = s_nationkey AND s_acctbal > 187;
n_nationkey
17
17
17
CREATE TABLE t (a INT );
INSERT INTO t VALUES (1),(17),(2),(17);
SELECT * FROM t WHERE a IN (
SELECT n_nationkey FROM nation LEFT JOIN region ON ( r_regionkey = n_regionkey ) JOIN supplier ON ( s_nationkey = n_nationkey ) JOIN partsupp ON ( s_suppkey = ps_suppkey ) JOIN lineitem ON ( ps_partkey = l_partkey ) JOIN orders ON ( l_orderkey = o_orderkey ) JOIN customer WHERE o_totalprice = 151 OR c_nationkey = s_nationkey AND s_acctbal > 187
);
a
So, the first SELECT above returns rows with value 17 .
The table t contains values 17 .
However, when the same SELECT is used as IN subquery, the resulting query doesn't return anything.
Plan:
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY supplier system PRIMARY NULL NULL NULL 1 100.00
1 PRIMARY nation const PRIMARY PRIMARY 4 const 1 100.00
1 PRIMARY region const PRIMARY PRIMARY 4 const 1 100.00 Using index
1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 1 100.00 Using where
1 PRIMARY t ALL NULL NULL NULL NULL 4 100.00 Using where ; Using join buffer (flat, BNL join )
2 MATERIALIZED lineitem ALL PRIMARY NULL NULL NULL 3 100.00 Using where
2 MATERIALIZED orders eq_ref PRIMARY PRIMARY 4 dbt3.lineitem.l_orderkey 1 100.00
2 MATERIALIZED customer index i_c_nationkey i_c_nationkey 5 NULL 3 100.00 Using where ; Using index ; Using join buffer (flat, BNL join )
2 MATERIALIZED partsupp eq_ref PRIMARY PRIMARY 8 dbt3.lineitem.l_partkey,const 1 100.00 Using index
Warnings:
Note 1003 select `dbt3`.`t`.`a` AS `a` from `dbt3`.`t` semi join (`dbt3`.`nation` left join `dbt3`.`region` on (1 = 1) join `dbt3`.`partsupp` join `dbt3`.`lineitem` join `dbt3`.`orders` join `dbt3`.`customer`) where `dbt3`.`t`.`a` = 17 and `dbt3`.`orders`.`o_orderkey` = `dbt3`.`lineitem`.`l_orderkey` and `dbt3`.`partsupp`.`ps_partkey` = `dbt3`.`lineitem`.`l_partkey` and `dbt3`.`partsupp`.`ps_suppkey` = 1 and (`dbt3`.`orders`.`o_totalprice` = 151 or `dbt3`.`customer`.`c_nationkey` = 17 and `dbt3`.`t`.`a` = 17)
Transition
Time In Source Status
Execution Times
Open
In Progress
3d 18h 32m
1
In Progress
Stalled
329d 2h 22m
1
{"report":{"fcp":1052.7999997138977,"ttfb":278.19999980926514,"pageVisibility":"visible","entityId":118051,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"a3ee06d1-70fd-46f9-adbd-92b27e513c7e","navigationType":0,"readyForUser":1173.5999999046326,"redirectCount":0,"resourceLoadedEnd":1275.6999998092651,"resourceLoadedStart":284.7999997138977,"resourceTiming":[{"duration":247.90000009536743,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":284.7999997138977,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":284.7999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":532.6999998092651,"responseStart":0,"secureConnectionStart":0},{"duration":248.09999990463257,"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":285,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":285,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":533.0999999046326,"responseStart":0,"secureConnectionStart":0},{"duration":257.09999990463257,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":285.19999980926514,"connectEnd":285.19999980926514,"connectStart":285.19999980926514,"domainLookupEnd":285.19999980926514,"domainLookupStart":285.19999980926514,"fetchStart":285.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":285.19999980926514,"responseEnd":542.2999997138977,"responseStart":542.2999997138977,"secureConnectionStart":285.19999980926514},{"duration":314.7999997138977,"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":285.40000009536743,"connectEnd":285.40000009536743,"connectStart":285.40000009536743,"domainLookupEnd":285.40000009536743,"domainLookupStart":285.40000009536743,"fetchStart":285.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":285.40000009536743,"responseEnd":600.1999998092651,"responseStart":600.1999998092651,"secureConnectionStart":285.40000009536743},{"duration":318.59999990463257,"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":286,"connectEnd":286,"connectStart":286,"domainLookupEnd":286,"domainLookupStart":286,"fetchStart":286,"redirectEnd":0,"redirectStart":0,"requestStart":286,"responseEnd":604.5999999046326,"responseStart":604.5999999046326,"secureConnectionStart":286},{"duration":318.80000019073486,"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":286.19999980926514,"connectEnd":286.19999980926514,"connectStart":286.19999980926514,"domainLookupEnd":286.19999980926514,"domainLookupStart":286.19999980926514,"fetchStart":286.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":286.19999980926514,"responseEnd":605,"responseStart":605,"secureConnectionStart":286.19999980926514},{"duration":319.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":286.40000009536743,"connectEnd":286.40000009536743,"connectStart":286.40000009536743,"domainLookupEnd":286.40000009536743,"domainLookupStart":286.40000009536743,"fetchStart":286.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":286.40000009536743,"responseEnd":605.5,"responseStart":605.5,"secureConnectionStart":286.40000009536743},{"duration":400.80000019073486,"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":286.59999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":286.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":687.4000000953674,"responseStart":0,"secureConnectionStart":0},{"duration":319.30000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":286.69999980926514,"connectEnd":286.69999980926514,"connectStart":286.69999980926514,"domainLookupEnd":286.69999980926514,"domainLookupStart":286.69999980926514,"fetchStart":286.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":286.69999980926514,"responseEnd":606,"responseStart":606,"secureConnectionStart":286.69999980926514},{"duration":400.69999980926514,"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":286.90000009536743,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":286.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":687.5999999046326,"responseStart":0,"secureConnectionStart":0},{"duration":319.59999990463257,"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":287,"connectEnd":287,"connectStart":287,"domainLookupEnd":287,"domainLookupStart":287,"fetchStart":287,"redirectEnd":0,"redirectStart":0,"requestStart":287,"responseEnd":606.5999999046326,"responseStart":606.5999999046326,"secureConnectionStart":287},{"duration":483.09999990463257,"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":287.69999980926514,"connectEnd":287.69999980926514,"connectStart":287.69999980926514,"domainLookupEnd":287.69999980926514,"domainLookupStart":287.69999980926514,"fetchStart":287.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":287.69999980926514,"responseEnd":770.7999997138977,"responseStart":770.7999997138977,"secureConnectionStart":287.69999980926514},{"duration":936,"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":287.7999997138977,"connectEnd":287.7999997138977,"connectStart":287.7999997138977,"domainLookupEnd":287.7999997138977,"domainLookupStart":287.7999997138977,"fetchStart":287.7999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":287.7999997138977,"responseEnd":1223.7999997138977,"responseStart":1223.7999997138977,"secureConnectionStart":287.7999997138977},{"duration":82.2999997138977,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":699.4000000953674,"connectEnd":699.4000000953674,"connectStart":699.4000000953674,"domainLookupEnd":699.4000000953674,"domainLookupStart":699.4000000953674,"fetchStart":699.4000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":699.4000000953674,"responseEnd":781.6999998092651,"responseStart":781.6999998092651,"secureConnectionStart":699.4000000953674},{"duration":290.5,"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":985,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":985,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1275.5,"responseStart":0,"secureConnectionStart":0},{"duration":290,"initiatorType":"link","name":"https://jira.mariadb.org/s/50bc9be5bfead1a25e72c1a9338c94f6-CDN/lu2cib/820016/12ta74/e108c7645258ccb43280ed3404e3e949/_/download/contextbatch/css/com.atlassian.jira.plugins.jira-development-integration-plugin:0,-_super,-jira.view.issue,-jira.global,-jira.general,-jira.browse.project,-project.issue.navigator,-atl.general/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":985.6999998092651,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":985.6999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1275.6999998092651,"responseStart":0,"secureConnectionStart":0},{"duration":262.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":986.5999999046326,"connectEnd":986.5999999046326,"connectStart":986.5999999046326,"domainLookupEnd":986.5999999046326,"domainLookupStart":986.5999999046326,"fetchStart":986.5999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":986.5999999046326,"responseEnd":1248.7999997138977,"responseStart":1248.7999997138977,"secureConnectionStart":986.5999999046326},{"duration":269,"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":987,"connectEnd":987,"connectStart":987,"domainLookupEnd":987,"domainLookupStart":987,"fetchStart":987,"redirectEnd":0,"redirectStart":0,"requestStart":987,"responseEnd":1256,"responseStart":1256,"secureConnectionStart":987},{"duration":269.90000009536743,"initiatorType":"script","name":"https://jira.mariadb.org/s/e0bf5781d46ea69fb123572974cf39de-CDN/lu2cib/820016/12ta74/e108c7645258ccb43280ed3404e3e949/_/download/contextbatch/js/com.atlassian.jira.plugins.jira-development-integration-plugin:0,-_super,-jira.view.issue,-jira.global,-jira.general,-jira.browse.project,-project.issue.navigator,-atl.general/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true&whisper-enabled=true","startTime":987.2999997138977,"connectEnd":987.2999997138977,"connectStart":987.2999997138977,"domainLookupEnd":987.2999997138977,"domainLookupStart":987.2999997138977,"fetchStart":987.2999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":987.2999997138977,"responseEnd":1257.1999998092651,"responseStart":1257.1999998092651,"secureConnectionStart":987.2999997138977},{"duration":323.09999990463257,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":1042.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1042.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1365.5999999046326,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":89,"responseStart":278,"responseEnd":282,"domLoading":281,"domInteractive":1310,"domContentLoadedEventStart":1310,"domContentLoadedEventEnd":1359,"domComplete":2164,"loadEventStart":2164,"loadEventEnd":2164,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1290.5},{"name":"bigPipe.sidebar-id.end","time":1292.0999999046326},{"name":"bigPipe.activity-panel-pipe-id.start","time":1292.4000000953674},{"name":"bigPipe.activity-panel-pipe-id.end","time":1293.5999999046326},{"name":"activityTabFullyLoaded","time":1380.7999997138977}],"measures":[],"correlationId":"8ce9ca71ab4131","effectiveType":"4g","downlink":9.2,"rtt":0,"serverDuration":108,"dbReadsTimeInMs":17,"dbConnsTimeInMs":25,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}