Type:
Bug
Priority:
Major
Resolution:
Fixed
Affects Version/s:
None
Fix Version/s:
None
Component/s:
None
The following query:
SELECT * FROM t3
WHERE t3.a IN (
SELECT t5.a FROM t2, t4, t5 WHERE ( t2.c = t5.a ) AND ( t2.b = t5.b )
);
returns 45 rows when executed with LooseScan, even though t3 contains just 15 rows. In addition, the query plan always contains FirstMatch regardless of whether the firstmatch switch is on or off.
Explain:
--- ----------------------------------------------------------------------------------------------------------+
id
select_type
table
type
possible_keys
key
key_len
ref
rows
Extra
--- ----------------------------------------------------------------------------------------------------------+
1
PRIMARY
t5
index
a
a
10
NULL
2
Using where; Using index; LooseScan
1
PRIMARY
t4
ALL
NULL
NULL
NULL
NULL
3
Using join buffer (flat, BNL join)
1
PRIMARY
t2
ref
b
b
5
test.t5.b
2
Using where; FirstMatch(t5)
1
PRIMARY
t3
ALL
NULL
NULL
NULL
NULL
15
Using where; Using join buffer (flat, BNL join)
--- ----------------------------------------------------------------------------------------------------------+
minimal optimizer switch: semijoin=on,loosescan=on
full optimizer switch:
index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=on,materialization=off,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on
bzr version-info:
revision-id: <email address hidden>
date: 2011-08-23 15:51:47 +0300
build-date: 2011-08-26 16:50:13 +0300
revno: 3166
branch-nick: maria-5.3
test case:
DROP TABLE IF EXISTS t2;
CREATE TABLE t2 ( b int, c int, KEY (b)) ;
INSERT INTO t2 VALUES (1,0),(1,0),(9,0),(1,0),(5,0);
DROP TABLE IF EXISTS t3;
CREATE TABLE t3 ( a int);
INSERT INTO t3 VALUES (0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0);
DROP TABLE IF EXISTS t4;
CREATE TABLE t4 ( a int);
INSERT INTO t4 VALUES (0),(0),(0);
DROP TABLE IF EXISTS t5;
CREATE TABLE t5 ( b int, a int , KEY (a,b)) ;
INSERT INTO t5 VALUES (7,0),(9,0);
SELECT * FROM t3
WHERE t3.a IN (
SELECT t5.a FROM t2, t4, t5 WHERE ( t2.c = t5.a ) AND ( t2.b = t5.b )
);
{"report":{"fcp":942.5,"ttfb":138.70000004768372,"pageVisibility":"visible","entityId":20911,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"69fdb729-0a0b-4f51-a874-6e6e03c67a57","navigationType":0,"readyForUser":1011.7000000476837,"redirectCount":0,"resourceLoadedEnd":1163.5,"resourceLoadedStart":144.09999990463257,"resourceTiming":[{"duration":321.10000014305115,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":144.09999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":144.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":465.2000000476837,"responseStart":0,"secureConnectionStart":0},{"duration":321,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2bu7/820016/12ta74/8679b4946efa1a0bb029a3a22206fb5d/_/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":144.29999995231628,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":144.29999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":465.2999999523163,"responseStart":0,"secureConnectionStart":0},{"duration":388.19999980926514,"initiatorType":"script","name":"https://jira.mariadb.org/s/fbf975c0cce4b1abf04784eeae9ba1f4-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":144.40000009536743,"connectEnd":144.40000009536743,"connectStart":144.40000009536743,"domainLookupEnd":144.40000009536743,"domainLookupStart":144.40000009536743,"fetchStart":144.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":144.40000009536743,"responseEnd":532.5999999046326,"responseStart":532.5999999046326,"secureConnectionStart":144.40000009536743},{"duration":478.10000014305115,"initiatorType":"script","name":"https://jira.mariadb.org/s/94c15bff32baef80f4096a08aceae8bc-CDN/lu2bu7/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":144.59999990463257,"connectEnd":144.59999990463257,"connectStart":144.59999990463257,"domainLookupEnd":144.59999990463257,"domainLookupStart":144.59999990463257,"fetchStart":144.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":144.59999990463257,"responseEnd":622.7000000476837,"responseStart":622.7000000476837,"secureConnectionStart":144.59999990463257},{"duration":474.40000009536743,"initiatorType":"script","name":"https://jira.mariadb.org/s/099b33461394b8015fc36c0a4b96e19f-CDN/lu2bu7/820016/12ta74/8679b4946efa1a0bb029a3a22206fb5d/_/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":144.59999990463257,"connectEnd":144.59999990463257,"connectStart":144.59999990463257,"domainLookupEnd":144.59999990463257,"domainLookupStart":144.59999990463257,"fetchStart":144.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":144.59999990463257,"responseEnd":619,"responseStart":619,"secureConnectionStart":144.59999990463257},{"duration":478.7000000476837,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":144.79999995231628,"connectEnd":144.79999995231628,"connectStart":144.79999995231628,"domainLookupEnd":144.79999995231628,"domainLookupStart":144.79999995231628,"fetchStart":144.79999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":144.79999995231628,"responseEnd":623.5,"responseStart":623.5,"secureConnectionStart":144.79999995231628},{"duration":479,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":144.90000009536743,"connectEnd":144.90000009536743,"connectStart":144.90000009536743,"domainLookupEnd":144.90000009536743,"domainLookupStart":144.90000009536743,"fetchStart":144.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":144.90000009536743,"responseEnd":623.9000000953674,"responseStart":623.9000000953674,"secureConnectionStart":144.90000009536743},{"duration":479.2999999523163,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2bu7/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":145,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":145,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":624.2999999523163,"responseStart":0,"secureConnectionStart":0},{"duration":479.2000000476837,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":145,"connectEnd":145,"connectStart":145,"domainLookupEnd":145,"domainLookupStart":145,"fetchStart":145,"redirectEnd":0,"redirectStart":0,"requestStart":145,"responseEnd":624.2000000476837,"responseStart":624.2000000476837,"secureConnectionStart":145},{"duration":479.39999985694885,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2bu7/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":145.20000004768372,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":145.20000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":624.5999999046326,"responseStart":0,"secureConnectionStart":0},{"duration":479.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/3339d87fa2538a859872f2df449bf8d0-CDN/lu2bu7/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":145.29999995231628,"connectEnd":145.29999995231628,"connectStart":145.29999995231628,"domainLookupEnd":145.29999995231628,"domainLookupStart":145.29999995231628,"fetchStart":145.29999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":145.29999995231628,"responseEnd":624.7999999523163,"responseStart":624.7999999523163,"secureConnectionStart":145.29999995231628},{"duration":906.2000000476837,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":150.5,"connectEnd":150.5,"connectStart":150.5,"domainLookupEnd":150.5,"domainLookupStart":150.5,"fetchStart":150.5,"redirectEnd":0,"redirectStart":0,"requestStart":150.5,"responseEnd":1056.7000000476837,"responseStart":1056.7000000476837,"secureConnectionStart":150.5},{"duration":1012.9000000953674,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":150.59999990463257,"connectEnd":150.59999990463257,"connectStart":150.59999990463257,"domainLookupEnd":150.59999990463257,"domainLookupStart":150.59999990463257,"fetchStart":150.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":150.59999990463257,"responseEnd":1163.5,"responseStart":1163.5,"secureConnectionStart":150.59999990463257},{"duration":370.2000000476837,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":689.0999999046326,"connectEnd":689.0999999046326,"connectStart":689.0999999046326,"domainLookupEnd":689.0999999046326,"domainLookupStart":689.0999999046326,"fetchStart":689.0999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":689.0999999046326,"responseEnd":1059.2999999523163,"responseStart":1059.2999999523163,"secureConnectionStart":689.0999999046326}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":13,"responseStart":139,"responseEnd":145,"domLoading":142,"domInteractive":1182,"domContentLoadedEventStart":1182,"domContentLoadedEventEnd":1220,"domComplete":1822,"loadEventStart":1822,"loadEventEnd":1824,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1165.5},{"name":"bigPipe.sidebar-id.end","time":1166.2999999523163},{"name":"bigPipe.activity-panel-pipe-id.start","time":1166.5},{"name":"bigPipe.activity-panel-pipe-id.end","time":1168.7999999523163},{"name":"activityTabFullyLoaded","time":1223.9000000953674}],"measures":[],"correlationId":"c78840d4ffea83","effectiveType":"4g","downlink":9.4,"rtt":0,"serverDuration":75,"dbReadsTimeInMs":10,"dbConnsTimeInMs":17,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}