-
Bug
-
-
Major
-
Resolution:
Unresolved
-
5.5(EOL), 10.0(EOL), 10.1(EOL), 10.2(EOL), 10.3(EOL)
-
-
-
Creating the dataset
create table ten(a int);
|
insert into ten values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
create table one_k(a int primary key);
|
insert into one_k select A.a + B.a* 10 + C.a * 100 from ten A, ten B, ten C;
|
|
create table t1 (a int, b int, c int, key(a));
|
create table t10 like t1;
|
insert into t10 select A.a +1000*B.a, A.a +1000*B.a,A.a +1000*B.a from one_k A, one_k B;
|
analyze table ten;
|
analyze table t10;
|
Good query plan
MariaDB [test]> set join_cache_level=2;
|
Query OK, 0 rows affected (0.000 sec)
|
|
MariaDB [test]>
|
MariaDB [test]> explain select * from ten, t10 where t10.a=ten.a;
|
+------+-------------+-------+------+---------------+------+---------+------------+------+-------------+
|
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
|
+------+-------------+-------+------+---------------+------+---------+------------+------+-------------+
|
| 1 | SIMPLE | ten | ALL | NULL | NULL | NULL | NULL | 10 | Using where |
|
| 1 | SIMPLE | t10 | ref | a | a | 5 | test.ten.a | 1 | |
|
+------+-------------+-------+------+---------------+------+---------+------------+------+-------------+
|
2 rows in set (0.001 sec)
|
These are default settings.
In this case
- we read 10 rows from table ten
- and for each we make an index lookup into t10 where we expect to find 1 row.
Bad query plan
MariaDB [test]> set join_cache_level=4;
|
Query OK, 0 rows affected (0.000 sec)
|
|
MariaDB [test]> explain select * from ten, t10 where t10.a=ten.a;
|
+------+-------------+-------+----------+---------------+---------+---------+------------+--------+-------------------------------------+
|
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
|
+------+-------------+-------+----------+---------------+---------+---------+------------+--------+-------------------------------------+
|
| 1 | SIMPLE | ten | ALL | NULL | NULL | NULL | NULL | 10 | Using where |
|
| 1 | SIMPLE | t10 | hash_ALL | a | #hash#a | 5 | test.ten.a | 997980 | Using join buffer (flat, BNLH join) |
|
+------+-------------+-------+----------+---------------+---------+---------+------------+--------+-------------------------------------+
|
2 rows in set (0.001 sec)
|
For this case
- it wants to read 10 rows from table ten
- put them into a buffer
- create a hash index on the buffer
- but then do a full table scan on t10 and read 1M rows
This is obviously very inefficient.
No workflow transitions have been executed yet.
{"report":{"fcp":1337.300000011921,"ttfb":370.9000000357628,"pageVisibility":"visible","entityId":67869,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"fcaf9375-b983-4846-841a-82e29da5e893","navigationType":0,"readyForUser":1433.6000000238419,"redirectCount":0,"resourceLoadedEnd":1404.300000011921,"resourceLoadedStart":376.5,"resourceTiming":[{"duration":374.5,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":376.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":376.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":751,"responseStart":0,"secureConnectionStart":0},{"duration":378.80000001192093,"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":376.80000001192093,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":376.80000001192093,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":755.6000000238419,"responseStart":0,"secureConnectionStart":0},{"duration":512,"initiatorType":"script","name":"https://jira.mariadb.org/s/fbf975c0cce4b1abf04784eeae9ba1f4-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":377,"connectEnd":377,"connectStart":377,"domainLookupEnd":377,"domainLookupStart":377,"fetchStart":377,"redirectEnd":0,"redirectStart":0,"requestStart":760.9000000357628,"responseEnd":889,"responseStart":776.8000000119209,"secureConnectionStart":377},{"duration":638.4000000357628,"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":377.19999998807907,"connectEnd":377.19999998807907,"connectStart":377.19999998807907,"domainLookupEnd":377.19999998807907,"domainLookupStart":377.19999998807907,"fetchStart":377.19999998807907,"redirectEnd":0,"redirectStart":0,"requestStart":768,"responseEnd":1015.6000000238419,"responseStart":782.1999999880791,"secureConnectionStart":377.19999998807907},{"duration":416,"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":377.30000001192093,"connectEnd":377.30000001192093,"connectStart":377.30000001192093,"domainLookupEnd":377.30000001192093,"domainLookupStart":377.30000001192093,"fetchStart":377.30000001192093,"redirectEnd":0,"redirectStart":0,"requestStart":774.8000000119209,"responseEnd":793.3000000119209,"responseStart":790.6000000238419,"secureConnectionStart":377.30000001192093},{"duration":417.4000000357628,"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":377.5,"connectEnd":377.5,"connectStart":377.5,"domainLookupEnd":377.5,"domainLookupStart":377.5,"fetchStart":377.5,"redirectEnd":0,"redirectStart":0,"requestStart":775.4000000357628,"responseEnd":794.9000000357628,"responseStart":792,"secureConnectionStart":377.5},{"duration":417.9000000357628,"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":377.69999998807907,"connectEnd":377.69999998807907,"connectStart":377.69999998807907,"domainLookupEnd":377.69999998807907,"domainLookupStart":377.69999998807907,"fetchStart":377.69999998807907,"redirectEnd":0,"redirectStart":0,"requestStart":775.6000000238419,"responseEnd":795.6000000238419,"responseStart":793.4000000357628,"secureConnectionStart":377.69999998807907},{"duration":397.39999997615814,"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":377.80000001192093,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":377.80000001192093,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":775.1999999880791,"responseStart":0,"secureConnectionStart":0},{"duration":421.19999998807907,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":378,"connectEnd":378,"connectStart":378,"domainLookupEnd":378,"domainLookupStart":378,"fetchStart":378,"redirectEnd":0,"redirectStart":0,"requestStart":778.6000000238419,"responseEnd":799.1999999880791,"responseStart":796.8000000119209,"secureConnectionStart":378},{"duration":397.39999997615814,"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":378.30000001192093,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":378.30000001192093,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":775.6999999880791,"responseStart":0,"secureConnectionStart":0},{"duration":422.19999998807907,"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":378.4000000357628,"connectEnd":378.4000000357628,"connectStart":378.4000000357628,"domainLookupEnd":378.4000000357628,"domainLookupStart":378.4000000357628,"fetchStart":378.4000000357628,"redirectEnd":0,"redirectStart":0,"requestStart":779,"responseEnd":800.6000000238419,"responseStart":797.6000000238419,"secureConnectionStart":378.4000000357628},{"duration":807.1999999880791,"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":384.10000002384186,"connectEnd":384.10000002384186,"connectStart":384.10000002384186,"domainLookupEnd":384.10000002384186,"domainLookupStart":384.10000002384186,"fetchStart":384.10000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":1175.4000000357628,"responseEnd":1191.300000011921,"responseStart":1185.4000000357628,"secureConnectionStart":384.10000002384186},{"duration":1020.1000000238419,"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":384.19999998807907,"connectEnd":384.19999998807907,"connectStart":384.19999998807907,"domainLookupEnd":384.19999998807907,"domainLookupStart":384.19999998807907,"fetchStart":384.19999998807907,"redirectEnd":0,"redirectStart":0,"requestStart":1394,"responseEnd":1404.300000011921,"responseStart":1403.199999988079,"secureConnectionStart":384.19999998807907},{"duration":220,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":1027,"connectEnd":1027,"connectStart":1027,"domainLookupEnd":1027,"domainLookupStart":1027,"fetchStart":1027,"redirectEnd":0,"redirectStart":0,"requestStart":1200.4000000357628,"responseEnd":1247,"responseStart":1234.4000000357628,"secureConnectionStart":1027},{"duration":184.10000002384186,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":1283.5,"connectEnd":1283.5,"connectStart":1283.5,"domainLookupEnd":1283.5,"domainLookupStart":1283.5,"fetchStart":1283.5,"redirectEnd":0,"redirectStart":0,"requestStart":1431.300000011921,"responseEnd":1467.6000000238419,"responseStart":1466.5,"secureConnectionStart":1283.5},{"duration":261.69999998807907,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":1328.9000000357628,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1328.9000000357628,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1590.6000000238419,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":147,"domainLookupEnd":164,"connectStart":164,"connectEnd":182,"secureConnectionStart":172,"requestStart":183,"responseStart":371,"responseEnd":376,"domLoading":375,"domInteractive":1537,"domContentLoadedEventStart":1537,"domContentLoadedEventEnd":1590,"domComplete":2080,"loadEventStart":2080,"loadEventEnd":2081,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1525.6000000238419},{"name":"bigPipe.sidebar-id.end","time":1526.4000000357628},{"name":"bigPipe.activity-panel-pipe-id.start","time":1526.6000000238419},{"name":"bigPipe.activity-panel-pipe-id.end","time":1527.1000000238419},{"name":"activityTabFullyLoaded","time":1600.9000000357628}],"measures":[],"correlationId":"1cd8c380f1ab5a","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":114,"dbReadsTimeInMs":24,"dbConnsTimeInMs":35,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}