Type:
Technical task
Priority:
Major
Resolution:
Unresolved
Affects Version/s:
N/A
This task is concerned with how we would show the sort_nest (MDEV-8306 )
in the explain or analyze output.
First thought would be to show the sort nest the same way as we do it for SJ Materialization or Derived tables
This is how it is done for Semi Join Materialization
MariaDB [test]> explain extended select * from t1 where a in (select a from t2 group by a);
+------+--------------+-------------+------+---------------+------+---------+------+------+----------+-------------------------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
+------+--------------+-------------+------+---------------+------+---------+------+------+----------+-------------------------------------------------+
| 1 | PRIMARY | <subquery2> | ALL | distinct_key | NULL | NULL | NULL | 5 | 100.00 | |
| 1 | PRIMARY | t1 | ALL | NULL | NULL | NULL | NULL | 100 | 100.00 | Using where; Using join buffer (flat, BNL join) |
| 2 | MATERIALIZED | t2 | ALL | NULL | NULL | NULL | NULL | 5 | 100.00 | |
+------+--------------+-------------+------+---------------+------+---------+------+------+----------+-------------------------------------------------+
Another one could be not to show the table for sort-nest and just mention in the EXTRA column of explain , using sort_nest with the tables inside it. Instead of using temporary, we can have Using Sort Nest.
MariaDB [test]> explain select * from t1,t2 where t1.a > 95 and t1.a=t2.a order by t2.a+1;
+------+-------------+-------+------+---------------+------+---------+-----------+------+----------------------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+------+-------------+-------+------+---------------+------+---------+-----------+------+----------------------------------------------+
| 1 | SIMPLE | t1 | ALL | NULL | NULL | NULL | NULL | 100 | Using where; Using temporary; Using filesort |
| 1 | SIMPLE | t2 | ref | a | a | 5 | test.t1.a | 1 | |
+------+-------------+-------+------+---------------+------+---------+-----------+------+----------------------------------------------+
2 rows in set (0.004 sec)
{"report":{"fcp":803.5,"ttfb":174.59999990463257,"pageVisibility":"visible","entityId":77762,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":32,"apdex":1,"journeyId":"52d1c360-0263-4805-9110-a7d520a9f07c","navigationType":0,"readyForUser":954.2999997138977,"redirectCount":0,"resourceLoadedEnd":1002.2999997138977,"resourceLoadedStart":182.09999990463257,"resourceTiming":[{"duration":29.800000190734863,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bv2/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":182.09999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":182.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":211.90000009536743,"responseStart":0,"secureConnectionStart":0},{"duration":30.5,"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":182.2999997138977,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":182.2999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":212.7999997138977,"responseStart":0,"secureConnectionStart":0},{"duration":90.2999997138977,"initiatorType":"script","name":"https://jira.mariadb.org/s/e9b27a47da5fb0f74a35acd57e9847fb-CDN/lu2bv2/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":182.5,"connectEnd":182.5,"connectStart":182.5,"domainLookupEnd":182.5,"domainLookupStart":182.5,"fetchStart":182.5,"redirectEnd":0,"redirectStart":0,"requestStart":182.5,"responseEnd":272.7999997138977,"responseStart":272.7999997138977,"secureConnectionStart":182.5},{"duration":175,"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":182.69999980926514,"connectEnd":182.69999980926514,"connectStart":182.69999980926514,"domainLookupEnd":182.69999980926514,"domainLookupStart":182.69999980926514,"fetchStart":182.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":182.69999980926514,"responseEnd":357.69999980926514,"responseStart":357.69999980926514,"secureConnectionStart":182.69999980926514},{"duration":178,"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":182.90000009536743,"connectEnd":182.90000009536743,"connectStart":182.90000009536743,"domainLookupEnd":182.90000009536743,"domainLookupStart":182.90000009536743,"fetchStart":182.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":182.90000009536743,"responseEnd":360.90000009536743,"responseStart":360.90000009536743,"secureConnectionStart":182.90000009536743},{"duration":178.40000009536743,"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":183.09999990463257,"connectEnd":183.09999990463257,"connectStart":183.09999990463257,"domainLookupEnd":183.09999990463257,"domainLookupStart":183.09999990463257,"fetchStart":183.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":183.09999990463257,"responseEnd":361.5,"responseStart":361.5,"secureConnectionStart":183.09999990463257},{"duration":178.5,"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":183.2999997138977,"connectEnd":183.2999997138977,"connectStart":183.2999997138977,"domainLookupEnd":183.2999997138977,"domainLookupStart":183.2999997138977,"fetchStart":183.2999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":183.2999997138977,"responseEnd":361.7999997138977,"responseStart":361.7999997138977,"secureConnectionStart":183.2999997138977},{"duration":237.5,"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":183.90000009536743,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":183.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":421.40000009536743,"responseStart":0,"secureConnectionStart":0},{"duration":178.80000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":184.19999980926514,"connectEnd":184.19999980926514,"connectStart":184.19999980926514,"domainLookupEnd":184.19999980926514,"domainLookupStart":184.19999980926514,"fetchStart":184.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":184.19999980926514,"responseEnd":363,"responseStart":363,"secureConnectionStart":184.19999980926514},{"duration":237.09999990463257,"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":184.40000009536743,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":184.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":421.5,"responseStart":0,"secureConnectionStart":0},{"duration":179.40000009536743,"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":184.59999990463257,"connectEnd":184.59999990463257,"connectStart":184.59999990463257,"domainLookupEnd":184.59999990463257,"domainLookupStart":184.59999990463257,"fetchStart":184.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":184.59999990463257,"responseEnd":364,"responseStart":364,"secureConnectionStart":184.59999990463257},{"duration":398.2999997138977,"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":185.40000009536743,"connectEnd":185.40000009536743,"connectStart":185.40000009536743,"domainLookupEnd":185.40000009536743,"domainLookupStart":185.40000009536743,"fetchStart":185.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":185.40000009536743,"responseEnd":583.6999998092651,"responseStart":583.6999998092651,"secureConnectionStart":185.40000009536743},{"duration":792.5999999046326,"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":185.59999990463257,"connectEnd":185.59999990463257,"connectStart":185.59999990463257,"domainLookupEnd":185.59999990463257,"domainLookupStart":185.59999990463257,"fetchStart":185.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":185.59999990463257,"responseEnd":978.1999998092651,"responseStart":978.1999998092651,"secureConnectionStart":185.59999990463257},{"duration":145.5,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":439,"connectEnd":439,"connectStart":439,"domainLookupEnd":439,"domainLookupStart":439,"fetchStart":439,"redirectEnd":0,"redirectStart":0,"requestStart":439,"responseEnd":584.5,"responseStart":584.5,"secureConnectionStart":439},{"duration":309.19999980926514,"initiatorType":"link","name":"https://jira.mariadb.org/s/d5715adaadd168a9002b108b2b039b50-CDN/lu2bv2/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":693.0999999046326,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":693.0999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1002.2999997138977,"responseStart":0,"secureConnectionStart":0},{"duration":349.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/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":694.2999997138977,"connectEnd":694.2999997138977,"connectStart":694.2999997138977,"domainLookupEnd":694.2999997138977,"domainLookupStart":694.2999997138977,"fetchStart":694.2999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":694.2999997138977,"responseEnd":1043.7999997138977,"responseStart":1043.7999997138977,"secureConnectionStart":694.2999997138977},{"duration":356.40000009536743,"initiatorType":"script","name":"https://jira.mariadb.org/s/53a43b6764f587426c7bb9a150184c00-CDN/lu2bv2/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":694.5999999046326,"connectEnd":694.5999999046326,"connectStart":694.5999999046326,"domainLookupEnd":694.5999999046326,"domainLookupStart":694.5999999046326,"fetchStart":694.5999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":694.5999999046326,"responseEnd":1051,"responseStart":1050.9000000953674,"secureConnectionStart":694.5999999046326}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":22,"responseStart":175,"responseEnd":178,"domLoading":179,"domInteractive":1010,"domContentLoadedEventStart":1010,"domContentLoadedEventEnd":1050,"domComplete":1724,"loadEventStart":1724,"loadEventEnd":1725,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":988.2999997138977},{"name":"bigPipe.sidebar-id.end","time":989.0999999046326},{"name":"bigPipe.activity-panel-pipe-id.start","time":989.2999997138977},{"name":"bigPipe.activity-panel-pipe-id.end","time":992.2999997138977},{"name":"activityTabFullyLoaded","time":1056.2999997138977}],"measures":[],"correlationId":"bc19fc5479e4b9","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":91,"dbReadsTimeInMs":10,"dbConnsTimeInMs":17,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}