Type:
Task
Priority:
Critical
Resolution:
Fixed
As of c10e10c6, opt_sum.cc is still stubbed for DESC indexes
if (part->key_part_flag & HA_REVERSE_SORT)
break; // TODO MDEV-13756
Given that we are about to close MDEV-13756 , it looks strange: either it was forgotten and needs to be enabled, or maybe it requires a better reference.
Given the above, the optimization expectedly doesn't work.
--source include/have_sequence.inc
create or replace table t1 (id int , key (id));
insert into t1 select seq from seq_1_to_100 order by rand(1);
explain extended select max (id) from t1 where id > 50;
create or replace table t1 (id int , key (id desc ));
insert into t1 select seq from seq_1_to_100 order by rand(1);
explain extended select max (id) from t1 where id > 50;
# Cleanup
drop table t1;
With the ASC index, it is
preview-10.8-MDEV-13756-desc-indexes c10e10c6
+ ------+-------------+-------+------+---------------+------+---------+------+------+----------+------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
+ ------+-------------+-------+------+---------------+------+---------+------+------+----------+------------------------------+
| 1 | SIMPLE | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | Select tables optimized away |
+ ------+-------------+-------+------+---------------+------+---------+------+------+----------+------------------------------+
With the DESC index, it is
+ ------+-------------+-------+-------+---------------+------+---------+------+------+----------+--------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
+ ------+-------------+-------+-------+---------------+------+---------+------+------+----------+--------------------------+
| 1 | SIMPLE | t1 | range | id | id | 5 | NULL | 50 | 100.00 | Using where ; Using index |
+ ------+-------------+-------+-------+---------------+------+---------+------+------+----------+--------------------------+
{"report":{"fcp":1207.6000003814697,"ttfb":263.1000003814697,"pageVisibility":"visible","entityId":107058,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"f636e2c9-869e-4bc3-8b2c-8bcb99988576","navigationType":0,"readyForUser":1358.2000002861023,"redirectCount":0,"resourceLoadedEnd":994.2000002861023,"resourceLoadedStart":268.5,"resourceTiming":[{"duration":332.80000019073486,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":268.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":268.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":601.3000001907349,"responseStart":0,"secureConnectionStart":0},{"duration":332.80000019073486,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/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&whisper-enabled=true","startTime":268.80000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":268.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":601.6000003814697,"responseStart":0,"secureConnectionStart":0},{"duration":342.1000003814697,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":269,"connectEnd":269,"connectStart":269,"domainLookupEnd":269,"domainLookupStart":269,"fetchStart":269,"redirectEnd":0,"redirectStart":0,"requestStart":269,"responseEnd":611.1000003814697,"responseStart":611.1000003814697,"secureConnectionStart":269},{"duration":444.2999997138977,"initiatorType":"script","name":"https://jira.mariadb.org/s/2d8175ec2fa4c816e8023260bd8c1786-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/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&whisper-enabled=true","startTime":269.1000003814697,"connectEnd":269.1000003814697,"connectStart":269.1000003814697,"domainLookupEnd":269.1000003814697,"domainLookupStart":269.1000003814697,"fetchStart":269.1000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":269.1000003814697,"responseEnd":713.4000000953674,"responseStart":713.4000000953674,"secureConnectionStart":269.1000003814697},{"duration":449,"initiatorType":"script","name":"https://jira.mariadb.org/s/a9324d6758d385eb45c462685ad88f1d-CDN/lu2cib/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":269.30000019073486,"connectEnd":269.30000019073486,"connectStart":269.30000019073486,"domainLookupEnd":269.30000019073486,"domainLookupStart":269.30000019073486,"fetchStart":269.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":269.30000019073486,"responseEnd":718.3000001907349,"responseStart":718.3000001907349,"secureConnectionStart":269.30000019073486},{"duration":449.30000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":269.5,"connectEnd":269.5,"connectStart":269.5,"domainLookupEnd":269.5,"domainLookupStart":269.5,"fetchStart":269.5,"redirectEnd":0,"redirectStart":0,"requestStart":269.5,"responseEnd":718.8000001907349,"responseStart":718.8000001907349,"secureConnectionStart":269.5},{"duration":449.59999990463257,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":269.7000002861023,"connectEnd":269.7000002861023,"connectStart":269.7000002861023,"domainLookupEnd":269.7000002861023,"domainLookupStart":269.7000002861023,"fetchStart":269.7000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":269.7000002861023,"responseEnd":719.3000001907349,"responseStart":719.3000001907349,"secureConnectionStart":269.7000002861023},{"duration":511.09999990463257,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2cib/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":269.80000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":269.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":780.9000000953674,"responseStart":0,"secureConnectionStart":0},{"duration":449.90000009536743,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":270,"connectEnd":270,"connectStart":270,"domainLookupEnd":270,"domainLookupStart":270,"fetchStart":270,"redirectEnd":0,"redirectStart":0,"requestStart":270,"responseEnd":719.9000000953674,"responseStart":719.9000000953674,"secureConnectionStart":270},{"duration":510.7999997138977,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2cib/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":270.2000002861023,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":270.2000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":781,"responseStart":0,"secureConnectionStart":0},{"duration":450.30000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/s/5d5e8fe91fbc506585e83ea3b62ccc4b-CDN/lu2cib/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":270.40000009536743,"connectEnd":270.40000009536743,"connectStart":270.40000009536743,"domainLookupEnd":270.40000009536743,"domainLookupStart":270.40000009536743,"fetchStart":270.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":270.40000009536743,"responseEnd":720.7000002861023,"responseStart":720.7000002861023,"secureConnectionStart":270.40000009536743},{"duration":568,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":276.30000019073486,"connectEnd":276.30000019073486,"connectStart":276.30000019073486,"domainLookupEnd":276.30000019073486,"domainLookupStart":276.30000019073486,"fetchStart":276.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":276.30000019073486,"responseEnd":844.3000001907349,"responseStart":844.3000001907349,"secureConnectionStart":276.30000019073486},{"duration":717.9000000953674,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":276.30000019073486,"connectEnd":276.30000019073486,"connectStart":276.30000019073486,"domainLookupEnd":276.30000019073486,"domainLookupStart":276.30000019073486,"fetchStart":276.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":276.30000019073486,"responseEnd":994.2000002861023,"responseStart":994.2000002861023,"secureConnectionStart":276.30000019073486},{"duration":49.90000009536743,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":795.4000000953674,"connectEnd":795.4000000953674,"connectStart":795.4000000953674,"domainLookupEnd":795.4000000953674,"domainLookupStart":795.4000000953674,"fetchStart":795.4000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":795.4000000953674,"responseEnd":845.3000001907349,"responseStart":845.3000001907349,"secureConnectionStart":795.4000000953674},{"duration":382.59999990463257,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/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&whisper-enabled=true","startTime":1113.7000002861023,"connectEnd":1113.7000002861023,"connectStart":1113.7000002861023,"domainLookupEnd":1113.7000002861023,"domainLookupStart":1113.7000002861023,"fetchStart":1113.7000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":1113.7000002861023,"responseEnd":1496.3000001907349,"responseStart":1496.3000001907349,"secureConnectionStart":1113.7000002861023}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":21,"responseStart":263,"responseEnd":273,"domLoading":266,"domInteractive":1455,"domContentLoadedEventStart":1455,"domContentLoadedEventEnd":1531,"domComplete":2035,"loadEventStart":2035,"loadEventEnd":2035,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1419.7000002861023},{"name":"bigPipe.sidebar-id.end","time":1423.5},{"name":"bigPipe.activity-panel-pipe-id.start","time":1423.7000002861023},{"name":"bigPipe.activity-panel-pipe-id.end","time":1425.4000000953674},{"name":"activityTabFullyLoaded","time":1549.2000002861023}],"measures":[],"correlationId":"91fd0fcb1a51d","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":134,"dbReadsTimeInMs":47,"dbConnsTimeInMs":59,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}