Type:
Bug
Priority:
Minor
Resolution:
Won't Fix
Affects Version/s:
None
Fix Version/s:
None
Component/s:
None
The following query
SELECT b FROM t1, t2 AS alias1, t2 AS alias2
WHERE alias2.c = SOME (
SELECT b FROM t1, t2
WHERE b != alias1.d )
OR b = alias1.d
LIMIT_ROWS_EXAMINED 5000
on the test data (small dataset) examines at least 15667 rows.
EXPLAIN:
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY alias1 ALL NULL NULL NULL NULL 100 100.00
1 PRIMARY alias2 index NULL PRIMARY 4 NULL 100 100.00 Using index; Using join buffer (flat, BNL join)
1 PRIMARY t1 ALL NULL NULL NULL NULL 106 100.00 Using where; Using join buffer (flat, BNL join)
2 DEPENDENT SUBQUERY t2 index NULL PRIMARY 4 NULL 100 100.00 Using index
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 106 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
Note 1276 Field or reference 'test.alias1.d' of SELECT #2 was resolved in SELECT #1
Note 1003 select `test`.`t1`.`b` AS `b` from `test`.`t1` join `test`.`t2` `alias1` join `test`.`t2` `alias2` where (<expr_cache><`test`.`alias2`.`c`,`test`.`alias1`.`d`>(<in_optimizer>(`test`.`alias2`.`c`,<exists>(select `test`.`t1`.`b` from `test`.`t1` join `test`.`t2` where ((`test`.`t1`.`b` <> `test`.`alias1`.`d`) and (<cache>(`test`.`alias2`.`c`) = `test`.`t1`.`b`))))) or (`test`.`t1`.`b` = `test`.`alias1`.`d`))
Minimal optimizer_switch:
in_to_exists=on,subquery_cache=on
Full optimizer_switch (default):
index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,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: timour@askmonty.org-20120213145248-tlvsd794o83odf2r
date: 2012-02-13 16:52:48 +0200
build-date: 2012-02-20 05:07:05 +0400
revno: 3417
Test case:
SET optimizer_switch = 'in_to_exists=on,subquery_cache=on';
CREATE TABLE t1 ( a INT AUTO_INCREMENT PRIMARY KEY, b INT );
INSERT INTO t1 (b) VALUES
(0),(2),(0),(1),(2),(NULL),(3),(8),(4),(4),(NULL),(9),(2),
(6),(6),(5),(3),(2),(6),(2),(3),(9),(9),(1),(7),(0),(0),
(112),(0),(4),(6),(0),(8),(4),(2),(1),(3),(2),(4),(144),
(7),(6),(3),(3),(6),(6),(9),(4),(6),(2),(28),(5),(NULL),
(8),(8),(0),(9),(NULL),(5),(172),(2),(244),(7),(0),(1),
(6),(NULL),(8),(8),(5),(5),(5),(7),(30),(NULL),(6),(8),
(NULL),(9),(2),(5),(4),(4),(0),(9),(1),(8),(9),(0),(7),
(2),(0),(5),(4),(5),(6),(NULL),(2),(9),(3),(0),(6),(5),
(8),(4),(NULL);
CREATE TABLE t2 ( c INT AUTO_INCREMENT PRIMARY KEY, d INT );
INSERT INTO t2 (d) VALUES
(2),(6),(6),(8),(2),(6),(8),(3),(3),(9),(6),(8),(3),(3),
(NULL),(7),(4),(7),(7),(8),(6),(3),(210),(1),(2),(251),(4),
(4),(9),(4),(NULL),(4),(NULL),(1),(6),(2),(NULL),(4),(248),
(4),(8),(4),(5),(9),(2),(4),(211),(2),(4),(125),(9),(4),
(8),(8),(NULL),(8),(4),(8),(NULL),(1),(3),(5),(8),(7),(2),
(NULL),(3),(NULL),(9),(1),(0),(0),(8),(NULL),(9),(1),(9),
(7),(2),(1),(9),(5),(4),(6),(5),(2),(4),(0),(3),(0),(6),
(1),(9),(4),(9),(4),(1),(2),(8),(1);
SELECT b FROM t1, t2 AS alias1, t2 AS alias2
WHERE alias2.c = SOME (
SELECT b FROM t1, t2
WHERE b != alias1.d )
OR b = alias1.d
LIMIT_ROWS_EXAMINED 5000;
relates to
MDEV-28
LIMIT ROWS EXAMINED clause to limit the number of rows examined during SELECT processing
Closed
Elena Stepanova
made changes -
2012-02-20 03:09
Field
Original Value
New Value
Link
This issue relates to TODO-81
[ TODO-81
]
Sergei Golubchik
made changes -
2014-06-13 15:06
Workflow
defaullt
[ 10900
]
MariaDB v2
[ 44748
]
Sergei Golubchik
made changes -
2021-12-06 21:36
Workflow
MariaDB v3
[ 64139
]
MariaDB v4
[ 144711
]
{"report":{"fcp":1037.3999999761581,"ttfb":249.69999992847443,"pageVisibility":"visible","entityId":10800,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"f78d6e10-ac21-466f-afae-aa8012f5386b","navigationType":0,"readyForUser":1106.0999999046326,"redirectCount":0,"resourceLoadedEnd":1452,"resourceLoadedStart":255.79999995231628,"resourceTiming":[{"duration":318.7999999523163,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":255.79999995231628,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":255.79999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":574.5999999046326,"responseStart":0,"secureConnectionStart":0},{"duration":318.8000000715256,"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":256.09999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":256.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":574.8999999761581,"responseStart":0,"secureConnectionStart":0},{"duration":327.7000000476837,"initiatorType":"script","name":"https://jira.mariadb.org/s/fbf975c0cce4b1abf04784eeae9ba1f4-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":256.2999999523163,"connectEnd":256.2999999523163,"connectStart":256.2999999523163,"domainLookupEnd":256.2999999523163,"domainLookupStart":256.2999999523163,"fetchStart":256.2999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":256.2999999523163,"responseEnd":584,"responseStart":584,"secureConnectionStart":256.2999999523163},{"duration":386,"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":256.5,"connectEnd":256.5,"connectStart":256.5,"domainLookupEnd":256.5,"domainLookupStart":256.5,"fetchStart":256.5,"redirectEnd":0,"redirectStart":0,"requestStart":256.5,"responseEnd":642.5,"responseStart":642.5,"secureConnectionStart":256.5},{"duration":389.39999997615814,"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":256.7999999523163,"connectEnd":256.7999999523163,"connectStart":256.7999999523163,"domainLookupEnd":256.7999999523163,"domainLookupStart":256.7999999523163,"fetchStart":256.7999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":256.7999999523163,"responseEnd":646.1999999284744,"responseStart":646.1999999284744,"secureConnectionStart":256.7999999523163},{"duration":389.7999999523163,"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":256.89999997615814,"connectEnd":256.89999997615814,"connectStart":256.89999997615814,"domainLookupEnd":256.89999997615814,"domainLookupStart":256.89999997615814,"fetchStart":256.89999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":256.89999997615814,"responseEnd":646.6999999284744,"responseStart":646.6999999284744,"secureConnectionStart":256.89999997615814},{"duration":390,"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":257.09999990463257,"connectEnd":257.09999990463257,"connectStart":257.09999990463257,"domainLookupEnd":257.09999990463257,"domainLookupStart":257.09999990463257,"fetchStart":257.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":257.09999990463257,"responseEnd":647.0999999046326,"responseStart":647.0999999046326,"secureConnectionStart":257.09999990463257},{"duration":468.10000002384186,"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":257.1999999284744,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":257.1999999284744,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":725.2999999523163,"responseStart":0,"secureConnectionStart":0},{"duration":390.1999999284744,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":257.39999997615814,"connectEnd":257.39999997615814,"connectStart":257.39999997615814,"domainLookupEnd":257.39999997615814,"domainLookupStart":257.39999997615814,"fetchStart":257.39999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":257.39999997615814,"responseEnd":647.5999999046326,"responseStart":647.5999999046326,"secureConnectionStart":257.39999997615814},{"duration":467.90000009536743,"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":257.59999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":257.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":725.5,"responseStart":0,"secureConnectionStart":0},{"duration":390.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":257.6999999284744,"connectEnd":257.6999999284744,"connectStart":257.6999999284744,"domainLookupEnd":257.6999999284744,"domainLookupStart":257.6999999284744,"fetchStart":257.6999999284744,"redirectEnd":0,"redirectStart":0,"requestStart":257.6999999284744,"responseEnd":648.1999999284744,"responseStart":648.1999999284744,"secureConnectionStart":257.6999999284744},{"duration":1168.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":258.6999999284744,"connectEnd":258.6999999284744,"connectStart":258.6999999284744,"domainLookupEnd":258.6999999284744,"domainLookupStart":258.6999999284744,"fetchStart":258.6999999284744,"redirectEnd":0,"redirectStart":0,"requestStart":258.6999999284744,"responseEnd":1426.8999999761581,"responseStart":1426.7999999523163,"secureConnectionStart":258.6999999284744},{"duration":1168.3999999761581,"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":258.89999997615814,"connectEnd":258.89999997615814,"connectStart":258.89999997615814,"domainLookupEnd":258.89999997615814,"domainLookupStart":258.89999997615814,"fetchStart":258.89999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":258.89999997615814,"responseEnd":1427.2999999523163,"responseStart":1427.2999999523163,"secureConnectionStart":258.89999997615814},{"duration":228,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":736.5,"connectEnd":736.5,"connectStart":736.5,"domainLookupEnd":736.5,"domainLookupStart":736.5,"fetchStart":736.5,"redirectEnd":0,"redirectStart":0,"requestStart":736.5,"responseEnd":964.5,"responseStart":964.5,"secureConnectionStart":736.5},{"duration":461.8000000715256,"initiatorType":"link","name":"https://jira.mariadb.org/s/d5715adaadd168a9002b108b2b039b50-CDN/lu2bu7/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","startTime":990.1999999284744,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":990.1999999284744,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1452,"responseStart":0,"secureConnectionStart":0},{"duration":445.09999990463257,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/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","startTime":991,"connectEnd":991,"connectStart":991,"domainLookupEnd":991,"domainLookupStart":991,"fetchStart":991,"redirectEnd":0,"redirectStart":0,"requestStart":991,"responseEnd":1436.0999999046326,"responseStart":1436.0999999046326,"secureConnectionStart":991},{"duration":450.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/f51ef5507eea4c158f257c66c93b2a3f-CDN/lu2bu7/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","startTime":991.3999999761581,"connectEnd":991.3999999761581,"connectStart":991.3999999761581,"domainLookupEnd":991.3999999761581,"domainLookupStart":991.3999999761581,"fetchStart":991.3999999761581,"redirectEnd":0,"redirectStart":0,"requestStart":991.3999999761581,"responseEnd":1441.8999999761581,"responseStart":1441.8999999761581,"secureConnectionStart":991.3999999761581},{"duration":428.10000002384186,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":1030.5999999046326,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1030.5999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1458.6999999284744,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":39,"responseStart":250,"responseEnd":253,"domLoading":253,"domInteractive":1462,"domContentLoadedEventStart":1462,"domContentLoadedEventEnd":1507,"domComplete":1874,"loadEventStart":1874,"loadEventEnd":1874,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1436.6999999284744},{"name":"bigPipe.sidebar-id.end","time":1437.5},{"name":"bigPipe.activity-panel-pipe-id.start","time":1437.6999999284744},{"name":"bigPipe.activity-panel-pipe-id.end","time":1439.7999999523163},{"name":"activityTabFullyLoaded","time":1522.5999999046326}],"measures":[],"correlationId":"83d68cced90558","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":110,"dbReadsTimeInMs":16,"dbConnsTimeInMs":24,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}