-
Task
-
-
Critical
-
Resolution:
Unresolved
-
-
-
-
Q2/2025 Development
Consider a query starting with table t1 and doing two LEFT JOINs to it:
set optimizer_trace=1;
|
|
explain
|
select *
|
from
|
t1
|
left join t3 on t3.key1=t1.a
|
left join t2 on t2.key1=t1.a;
|
+------+-------------+-------+------+-----------------+---------+---------+---------+------+-------------+
|
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
|
+------+-------------+-------+------+-----------------+---------+---------+---------+------+-------------+
|
| 1 | SIMPLE | t1 | ALL | NULL | NULL | NULL | NULL | 10 | |
|
| 1 | SIMPLE | t3 | ref | t3_key2 | t3_key2 | 5 | j1.t1.a | 100 | Using where |
|
| 1 | SIMPLE | t2 | ref | t2_key1,t3_key1 | t2_key1 | 5 | j1.t1.a | 10 | Using where |
|
+------+-------------+-------+------+-----------------+---------+---------+---------+------+-------------+
|
The optimizer trace shows that t1-t3-t2 is the only acceptable join order:
{
|
"table_dependencies": [
|
{
|
"table": "t1",
|
"row_may_be_null": false,
|
"map_bit": 0,
|
"depends_on_map_bits": []
|
},
|
{
|
"table": "t3",
|
"row_may_be_null": true,
|
"map_bit": 1,
|
"depends_on_map_bits": ["0"]
|
},
|
{
|
"table": "t2",
|
"row_may_be_null": true,
|
"map_bit": 2,
|
"depends_on_map_bits": ["0", "1"]
|
}
|
]
|
But is t1-t2-t3 order also allowed?
Notes
MySQL also has this limitation, and it seems so does PostgreSQL.
Rephrasing the task
Is
t1
|
left join t3 on t3.key1=t1.a
|
left join t2 on t2.key1=t1.a
|
equivalent to
t1
|
left join t2 on t2.key1=t1.a
|
left join t3 on t3.key1=t1.a
|
- relates to
-
MDEV-13817
add support for oracle outer join syntax - the ( + )
-
-
In Review
{"report":{"fcp":1794.7999999523163,"ttfb":647.1000000238419,"pageVisibility":"visible","entityId":132776,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"9d90858e-5cce-41a2-a6c0-53b93418aa53","navigationType":0,"readyForUser":1860.1999999284744,"redirectCount":0,"resourceLoadedEnd":2093.600000023842,"resourceLoadedStart":652.5,"resourceTiming":[{"duration":676.3999999761581,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":652.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":652.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1328.8999999761581,"responseStart":0,"secureConnectionStart":0},{"duration":676.1000000238419,"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":652.8999999761581,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":652.8999999761581,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1329,"responseStart":0,"secureConnectionStart":0},{"duration":728.3999999761581,"initiatorType":"script","name":"https://jira.mariadb.org/s/fbf975c0cce4b1abf04784eeae9ba1f4-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":653,"connectEnd":653,"connectStart":653,"domainLookupEnd":653,"domainLookupStart":653,"fetchStart":653,"redirectEnd":0,"redirectStart":0,"requestStart":653,"responseEnd":1381.3999999761581,"responseStart":1381.2999999523163,"secureConnectionStart":653},{"duration":781.5999999046326,"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":653.1000000238419,"connectEnd":653.1000000238419,"connectStart":653.1000000238419,"domainLookupEnd":653.1000000238419,"domainLookupStart":653.1000000238419,"fetchStart":653.1000000238419,"redirectEnd":0,"redirectStart":0,"requestStart":653.1000000238419,"responseEnd":1434.6999999284744,"responseStart":1434.6999999284744,"secureConnectionStart":653.1000000238419},{"duration":785.4000000953674,"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":653.1999999284744,"connectEnd":653.1999999284744,"connectStart":653.1999999284744,"domainLookupEnd":653.1999999284744,"domainLookupStart":653.1999999284744,"fetchStart":653.1999999284744,"redirectEnd":0,"redirectStart":0,"requestStart":653.1999999284744,"responseEnd":1438.6000000238419,"responseStart":1438.6000000238419,"secureConnectionStart":653.1999999284744},{"duration":785.6000000238419,"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":653.3999999761581,"connectEnd":653.3999999761581,"connectStart":653.3999999761581,"domainLookupEnd":653.3999999761581,"domainLookupStart":653.3999999761581,"fetchStart":653.3999999761581,"redirectEnd":0,"redirectStart":0,"requestStart":653.3999999761581,"responseEnd":1439,"responseStart":1439,"secureConnectionStart":653.3999999761581},{"duration":786.1000000238419,"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":653.3999999761581,"connectEnd":653.3999999761581,"connectStart":653.3999999761581,"domainLookupEnd":653.3999999761581,"domainLookupStart":653.3999999761581,"fetchStart":653.3999999761581,"redirectEnd":0,"redirectStart":0,"requestStart":653.3999999761581,"responseEnd":1439.5,"responseStart":1439.5,"secureConnectionStart":653.3999999761581},{"duration":786.3999999761581,"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":653.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":653.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1439.8999999761581,"responseStart":0,"secureConnectionStart":0},{"duration":786.2999999523163,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":653.6000000238419,"connectEnd":653.6000000238419,"connectStart":653.6000000238419,"domainLookupEnd":653.6000000238419,"domainLookupStart":653.6000000238419,"fetchStart":653.6000000238419,"redirectEnd":0,"redirectStart":0,"requestStart":653.6000000238419,"responseEnd":1439.8999999761581,"responseStart":1439.8999999761581,"secureConnectionStart":653.6000000238419},{"duration":786.8000000715256,"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":653.6999999284744,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":653.6999999284744,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1440.5,"responseStart":0,"secureConnectionStart":0},{"duration":786.8000000715256,"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":653.7999999523163,"connectEnd":653.7999999523163,"connectStart":653.7999999523163,"domainLookupEnd":653.7999999523163,"domainLookupStart":653.7999999523163,"fetchStart":653.7999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":653.7999999523163,"responseEnd":1440.6000000238419,"responseStart":1440.6000000238419,"secureConnectionStart":653.7999999523163},{"duration":1327.8000000715256,"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":659.7999999523163,"connectEnd":659.7999999523163,"connectStart":659.7999999523163,"domainLookupEnd":659.7999999523163,"domainLookupStart":659.7999999523163,"fetchStart":659.7999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":659.7999999523163,"responseEnd":1987.6000000238419,"responseStart":1987.6000000238419,"secureConnectionStart":659.7999999523163},{"duration":1433.8000000715256,"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":659.7999999523163,"connectEnd":659.7999999523163,"connectStart":659.7999999523163,"domainLookupEnd":659.7999999523163,"domainLookupStart":659.7999999523163,"fetchStart":659.7999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":659.7999999523163,"responseEnd":2093.600000023842,"responseStart":2093.600000023842,"secureConnectionStart":659.7999999523163},{"duration":442.39999997615814,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":1599.8999999761581,"connectEnd":1599.8999999761581,"connectStart":1599.8999999761581,"domainLookupEnd":1599.8999999761581,"domainLookupStart":1599.8999999761581,"fetchStart":1599.8999999761581,"redirectEnd":0,"redirectStart":0,"requestStart":1599.8999999761581,"responseEnd":2042.2999999523163,"responseStart":2042.2999999523163,"secureConnectionStart":1599.8999999761581},{"duration":331.5,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":1773.8999999761581,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1773.8999999761581,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":2105.399999976158,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":481,"responseStart":647,"responseEnd":658,"domLoading":650,"domInteractive":2114,"domContentLoadedEventStart":2114,"domContentLoadedEventEnd":2153,"domComplete":2924,"loadEventStart":2925,"loadEventEnd":2926,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":2095.600000023842},{"name":"bigPipe.sidebar-id.end","time":2096.5},{"name":"bigPipe.activity-panel-pipe-id.start","time":2096.6999999284744},{"name":"bigPipe.activity-panel-pipe-id.end","time":2099.1999999284744},{"name":"activityTabFullyLoaded","time":2159.899999976158}],"measures":[],"correlationId":"13c831b739fc4","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":94,"dbReadsTimeInMs":9,"dbConnsTimeInMs":17,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}