Type:
Bug
Priority:
Major
Resolution:
Fixed
Affects Version/s:
10.1(EOL) , 10.2(EOL) , 10.3(EOL) , 10.4(EOL) , 10.5
An example
EXPLAIN SELECT * FROM one_k
WHERE a IN ( SELECT t10.b
FROM t10, t11, t12, t13, t14
WHERE t11.a=t10.b+1 AND t12.a=t10.b AND
t13.a=t10.b AND t14.a=t10.b);
this case uses Semi Join Materializaion and the subquery is added to the table list of select #1.
The total number of tables for select #1 is 1(one_k)+ 5(inner_tables) + 1(SJM_TABLE). But for the top level we are only considered about 2 and should only have two JOIN_TAB structures.
In the function JOIN::get_best_combination
we allocate space for JOIN_TAB array like
if (!(join_tab= (JOIN_TAB*) thd->alloc( sizeof (JOIN_TAB)*
(top_join_tab_count + aggr_tables))))
In the debugger
(gdb) p top_join_tab_count
$8 = 6
So in this issue we would like to correct the value of top_join_tab_count, to only consider the tables that would be present at the top level. In this case
the value of top_join_tab_count should be 2.
Varun Gupta (Inactive)
made changes -
2019-09-02 13:35
Field
Original Value
New Value
Description
An example
{code:sql}
EXPLAIN SELECT * FROM one_k
WHERE a IN (SELECT t10.b
FROM t10, t11, t12, t13, t14
WHERE t11.a=t10.b+1 AND t12.a=t10.b AND
t13.a=t10.b AND t14.a=t10.b);
{code}
this case uses Semi Join Materializaion and the subquery is added to the table list of select #1.
The total number of tables for select #1 is 1(one_k)+ 5(inner_tables) + 1(SJM_TABLE). But for the top level we are only considered about 2 and should only have two JOIN_TAB structures.
In the function JOIN::get_best_combination
we allocate space for JOIN_TAB array like
{code:c++}
if (!(join_tab= (JOIN_TAB*) thd->alloc(sizeof(JOIN_TAB)*
(top_join_tab_count + aggr_tables))))
{code}
In the debugger
(gdb) p top_join_tab_count
$8 = 6
So in this issue we would like to correct the value of top_join_tab_count, to only consider the tables that would be present at the top level. In this case
the value of top_join_tab_count should be 2.
Varun Gupta (Inactive)
made changes -
2019-09-02 13:35
Summary
Allocating more space for JOIN_TAB array for a select with SJM table
Allocating more space than required for JOIN_TAB array for a query with SJM table
Varun Gupta (Inactive)
made changes -
2019-09-02 14:19
Assignee
Varun Gupta
[ varun
]
Sergei Petrunia
[ psergey
]
Status
In Progress
[ 3
]
In Review
[ 10002
]
Sergei Petrunia
made changes -
2019-09-19 09:26
Assignee
Sergei Petrunia
[ psergey
]
Varun Gupta
[ varun
]
Status
In Review
[ 10002
]
Stalled
[ 10000
]
Varun Gupta (Inactive)
made changes -
2019-09-25 05:53
Fix Version/s
10.5.0
[ 23709
]
Fix Version/s
10.5
[ 23123
]
Resolution
Fixed
[ 1
]
Status
Stalled
[ 10000
]
Closed
[ 6
]
Sergei Golubchik
made changes -
2021-12-06 21:50
Workflow
MariaDB v3
[ 99361
]
MariaDB v4
[ 156689
]
{"report":{"fcp":1131.0999994277954,"ttfb":374.80000019073486,"pageVisibility":"visible","entityId":78660,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"1178eca3-7d05-453d-a35a-07264ea4e0f3","navigationType":0,"readyForUser":1199.5999994277954,"redirectCount":0,"resourceLoadedEnd":921.6999998092651,"resourceLoadedStart":383.0999994277954,"resourceTiming":[{"duration":165.60000038146973,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bv2/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":383.0999994277954,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":383.0999994277954,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":548.6999998092651,"responseStart":0,"secureConnectionStart":0},{"duration":166,"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":383.3999996185303,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":383.3999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":549.3999996185303,"responseStart":0,"secureConnectionStart":0},{"duration":288.6000003814697,"initiatorType":"script","name":"https://jira.mariadb.org/s/e9b27a47da5fb0f74a35acd57e9847fb-CDN/lu2bv2/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":383.5999994277954,"connectEnd":383.5999994277954,"connectStart":383.5999994277954,"domainLookupEnd":383.5999994277954,"domainLookupStart":383.5999994277954,"fetchStart":383.5999994277954,"redirectEnd":0,"redirectStart":0,"requestStart":554.3000001907349,"responseEnd":672.1999998092651,"responseStart":574.3999996185303,"secureConnectionStart":383.5999994277954},{"duration":354.80000019073486,"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":383.8999996185303,"connectEnd":383.8999996185303,"connectStart":383.8999996185303,"domainLookupEnd":383.8999996185303,"domainLookupStart":383.8999996185303,"fetchStart":383.8999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":554.5,"responseEnd":738.6999998092651,"responseStart":584,"secureConnectionStart":383.8999996185303},{"duration":202.30000019073486,"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":384.0999994277954,"connectEnd":384.0999994277954,"connectStart":384.0999994277954,"domainLookupEnd":384.0999994277954,"domainLookupStart":384.0999994277954,"fetchStart":384.0999994277954,"redirectEnd":0,"redirectStart":0,"requestStart":554.6999998092651,"responseEnd":586.3999996185303,"responseStart":584.8999996185303,"secureConnectionStart":384.0999994277954},{"duration":193.89999961853027,"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":384.19999980926514,"connectEnd":384.19999980926514,"connectStart":384.19999980926514,"domainLookupEnd":384.19999980926514,"domainLookupStart":384.19999980926514,"fetchStart":384.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":555.5,"responseEnd":578.0999994277954,"responseStart":575.8999996185303,"secureConnectionStart":384.19999980926514},{"duration":193.89999961853027,"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":384.5,"connectEnd":384.5,"connectStart":384.5,"domainLookupEnd":384.5,"domainLookupStart":384.5,"fetchStart":384.5,"redirectEnd":0,"redirectStart":0,"requestStart":556.1999998092651,"responseEnd":578.3999996185303,"responseStart":576.5999994277954,"secureConnectionStart":384.5},{"duration":170.30000019073486,"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":384.5999994277954,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":384.5999994277954,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":554.8999996185303,"responseStart":0,"secureConnectionStart":0},{"duration":195.89999961853027,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":384.80000019073486,"connectEnd":384.80000019073486,"connectStart":384.80000019073486,"domainLookupEnd":384.80000019073486,"domainLookupStart":384.80000019073486,"fetchStart":384.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":558,"responseEnd":580.6999998092651,"responseStart":579.3999996185303,"secureConnectionStart":384.80000019073486},{"duration":170.80000019073486,"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":384.8999996185303,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":384.8999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":555.6999998092651,"responseStart":0,"secureConnectionStart":0},{"duration":203.80000019073486,"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":385.0999994277954,"connectEnd":385.0999994277954,"connectStart":385.0999994277954,"domainLookupEnd":385.0999994277954,"domainLookupStart":385.0999994277954,"fetchStart":385.0999994277954,"redirectEnd":0,"redirectStart":0,"requestStart":567.8999996185303,"responseEnd":588.8999996185303,"responseStart":587.5999994277954,"secureConnectionStart":385.0999994277954},{"duration":432.1000003814697,"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":386.0999994277954,"connectEnd":386.0999994277954,"connectStart":386.0999994277954,"domainLookupEnd":386.0999994277954,"domainLookupStart":386.0999994277954,"fetchStart":386.0999994277954,"redirectEnd":0,"redirectStart":0,"requestStart":806,"responseEnd":818.1999998092651,"responseStart":817.3000001907349,"secureConnectionStart":386.0999994277954},{"duration":535.5,"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":386.19999980926514,"connectEnd":386.19999980926514,"connectStart":386.19999980926514,"domainLookupEnd":386.19999980926514,"domainLookupStart":386.19999980926514,"fetchStart":386.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":912.0999994277954,"responseEnd":921.6999998092651,"responseStart":921.0999994277954,"secureConnectionStart":386.19999980926514},{"duration":232.30000019073486,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":869.5999994277954,"connectEnd":869.5999994277954,"connectStart":869.5999994277954,"domainLookupEnd":869.5999994277954,"domainLookupStart":869.5999994277954,"fetchStart":869.5999994277954,"redirectEnd":0,"redirectStart":0,"requestStart":1072.5,"responseEnd":1101.8999996185303,"responseStart":1099.6999998092651,"secureConnectionStart":869.5999994277954}],"fetchStart":0,"domainLookupStart":151,"domainLookupEnd":161,"connectStart":161,"connectEnd":179,"secureConnectionStart":169,"requestStart":181,"responseStart":375,"responseEnd":380,"domLoading":381,"domInteractive":1257,"domContentLoadedEventStart":1257,"domContentLoadedEventEnd":1296,"domComplete":2279,"loadEventStart":2279,"loadEventEnd":2279,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1235.8000001907349},{"name":"bigPipe.sidebar-id.end","time":1236.6999998092651},{"name":"bigPipe.activity-panel-pipe-id.start","time":1236.8999996185303},{"name":"bigPipe.activity-panel-pipe-id.end","time":1239.8000001907349},{"name":"activityTabFullyLoaded","time":1326}],"measures":[],"correlationId":"eb745e09a09a74","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":132,"dbReadsTimeInMs":23,"dbConnsTimeInMs":32,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}