This bug affects MariaDB 5.5.3x perhaps older versions too.
This bug concerns also all MySQL 5.6 versions (>= 5.6.8), it will be fixed on 5.6.14 : http://bugs.mysql.com/bug.php?id=69581
The test case below comes from the above link :
USE test;
|
DROP TABLE IF EXISTS `table1`;
|
CREATE TABLE `table1` (
|
`col1` bigint(20) unsigned NOT NULL ,
|
`col2` bigint(20) unsigned NOT NULL ,
|
`col3` datetime NOT NULL ,
|
PRIMARY KEY (`col3`),
|
KEY (`col1`),
|
KEY (`col2`)
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
PARTITION BY RANGE (TO_DAYS(col3))
|
(
|
PARTITION p_20130310 VALUES LESS THAN (735303) ENGINE = InnoDB,
|
PARTITION p_20130311 VALUES LESS THAN (735304) ENGINE = InnoDB,
|
PARTITION p_20130312 VALUES LESS THAN (735305) ENGINE = InnoDB
|
);
|
INSERT INTO `table1` VALUES (2,96,'2013-03-08 16:28:05');
|
INSERT INTO `table1` VALUES (1,2,'2013-03-08 16:47:39');
|
INSERT INTO `table1` VALUES (1,2,'2013-03-08 16:50:27');
|
INSERT INTO `table1` VALUES (1,2,'2013-03-11 16:33:04');
|
INSERT INTO `table1` VALUES (1,2,'2013-03-11 16:33:24');
|
INSERT INTO `table1` VALUES (2,2,'2013-03-12 10:11:48');
|
|
SET optimizer_switch='index_merge=on';
|
SELECT @@optimizer_switch;
|
SELECT * FROM table1 WHERE col1 = 1 AND col2 = 2
|
AND col3 BETWEEN '2013-03-08 00:00:00' AND '2013-03-12 12:00:00'
|
GROUP BY 1, 2, 3;
|
EXPLAIN SELECT * FROM table1 WHERE col1 = 1 AND col2 = 2
|
AND col3 BETWEEN '2013-03-08 00:00:00' AND '2013-03-12 12:00:00'
|
GROUP BY 1, 2, 3;
|
|
SET optimizer_switch='index_merge=off';
|
SELECT @@optimizer_switch;
|
SELECT * FROM table1 WHERE col1 = 1 AND col2 = 2
|
AND col3 BETWEEN '2013-03-08 00:00:00' AND '2013-03-12 12:00:00'
|
GROUP BY 1, 2, 3;
|
EXPLAIN SELECT * FROM table1 WHERE col1 = 1 AND col2 = 2
|
AND col3 BETWEEN '2013-03-08 00:00:00' AND '2013-03-12 12:00:00'
|
GROUP BY 1, 2, 3;
|
With index_merge=on you obtain :
+------+------+---------------------+
|
| col1 | col2 | col3 |
|
+------+------+---------------------+
|
| 1 | 2 | 2013-03-08 16:47:39 |
|
| 1 | 2 | 2013-03-08 16:50:27 |
|
+------+------+---------------------+
|
2 rows in set (0.00 sec)
|
but you should obtain what you have when you disable index_merge :
+------+------+---------------------+
|
| col1 | col2 | col3 |
|
+------+------+---------------------+
|
| 1 | 2 | 2013-03-08 16:47:39 |
|
| 1 | 2 | 2013-03-08 16:50:27 |
|
| 1 | 2 | 2013-03-11 16:33:04 |
|
| 1 | 2 | 2013-03-11 16:33:24 |
|
+------+------+---------------------+
|
4 rows in set (0.00 sec)
|
Transition |
Time In Source Status |
Execution Times |
Open |
|
In Progress |
|
14d 8h 59m
|
1
|
In Progress |
|
Closed |
|
1d 14h 40m
|
1
|
{"report":{"fcp":745.5,"ttfb":208,"pageVisibility":"visible","entityId":25938,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":1,"journeyId":"592e881f-6e6a-4ace-9cd6-e3b285147626","navigationType":0,"readyForUser":873.5999994277954,"redirectCount":0,"resourceLoadedEnd":476,"resourceLoadedStart":213.30000019073486,"resourceTiming":[{"duration":6.59999942779541,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":213.30000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":213.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":219.89999961853027,"responseStart":0,"secureConnectionStart":0},{"duration":6.899999618530273,"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":213.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":213.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":220.39999961853027,"responseStart":0,"secureConnectionStart":0},{"duration":151.30000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/s/fbf975c0cce4b1abf04784eeae9ba1f4-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":213.69999980926514,"connectEnd":213.69999980926514,"connectStart":213.69999980926514,"domainLookupEnd":213.69999980926514,"domainLookupStart":213.69999980926514,"fetchStart":213.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":222.19999980926514,"responseEnd":365,"responseStart":238,"secureConnectionStart":213.69999980926514},{"duration":32.69999980926514,"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":213.80000019073486,"connectEnd":213.80000019073486,"connectStart":213.80000019073486,"domainLookupEnd":213.80000019073486,"domainLookupStart":213.80000019073486,"fetchStart":213.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":224.69999980926514,"responseEnd":246.5,"responseStart":244.5,"secureConnectionStart":213.80000019073486},{"duration":260.3999996185303,"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":213.80000019073486,"connectEnd":213.80000019073486,"connectStart":213.80000019073486,"domainLookupEnd":213.80000019073486,"domainLookupStart":213.80000019073486,"fetchStart":213.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":222.69999980926514,"responseEnd":474.19999980926514,"responseStart":239.89999961853027,"secureConnectionStart":213.80000019073486},{"duration":36.09999942779541,"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":214,"connectEnd":214,"connectStart":214,"domainLookupEnd":214,"domainLookupStart":214,"fetchStart":214,"redirectEnd":0,"redirectStart":0,"requestStart":228.39999961853027,"responseEnd":250.0999994277954,"responseStart":247.0999994277954,"secureConnectionStart":214},{"duration":10.300000190734863,"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":214.0999994277954,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":214.0999994277954,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":224.39999961853027,"responseStart":0,"secureConnectionStart":0},{"duration":39.40000057220459,"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":214.0999994277954,"connectEnd":214.0999994277954,"connectStart":214.0999994277954,"domainLookupEnd":214.0999994277954,"domainLookupStart":214.0999994277954,"fetchStart":214.0999994277954,"redirectEnd":0,"redirectStart":0,"requestStart":229.19999980926514,"responseEnd":253.5,"responseStart":249,"secureConnectionStart":214.0999994277954},{"duration":37.10000038146973,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":214.19999980926514,"connectEnd":214.19999980926514,"connectStart":214.19999980926514,"domainLookupEnd":214.19999980926514,"domainLookupStart":214.19999980926514,"fetchStart":214.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":229.5,"responseEnd":251.30000019073486,"responseStart":248.0999994277954,"secureConnectionStart":214.19999980926514},{"duration":12.300000190734863,"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":214.39999961853027,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":214.39999961853027,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":226.69999980926514,"responseStart":0,"secureConnectionStart":0},{"duration":40.09999942779541,"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":214.5,"connectEnd":214.5,"connectStart":214.5,"domainLookupEnd":214.5,"domainLookupStart":214.5,"fetchStart":214.5,"redirectEnd":0,"redirectStart":0,"requestStart":232.39999961853027,"responseEnd":254.5999994277954,"responseStart":251.5999994277954,"secureConnectionStart":214.5},{"duration":255.30000019073486,"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":220.5999994277954,"connectEnd":220.5999994277954,"connectStart":220.5999994277954,"domainLookupEnd":220.5999994277954,"domainLookupStart":220.5999994277954,"fetchStart":220.5999994277954,"redirectEnd":0,"redirectStart":0,"requestStart":237.5,"responseEnd":475.8999996185303,"responseStart":468.3999996185303,"secureConnectionStart":220.5999994277954},{"duration":255.4000005722046,"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":220.5999994277954,"connectEnd":220.5999994277954,"connectStart":220.5999994277954,"domainLookupEnd":220.5999994277954,"domainLookupStart":220.5999994277954,"fetchStart":220.5999994277954,"redirectEnd":0,"redirectStart":0,"requestStart":237.89999961853027,"responseEnd":476,"responseStart":469.19999980926514,"secureConnectionStart":220.5999994277954},{"duration":78.60000038146973,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":508.3999996185303,"connectEnd":508.3999996185303,"connectStart":508.3999996185303,"domainLookupEnd":508.3999996185303,"domainLookupStart":508.3999996185303,"fetchStart":508.3999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":555.8000001907349,"responseEnd":587,"responseStart":586.0999994277954,"secureConnectionStart":508.3999996185303},{"duration":143.19999980926514,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":739.3999996185303,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":739.3999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":882.5999994277954,"responseStart":0,"secureConnectionStart":0},{"duration":169.89999961853027,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":745.8000001907349,"connectEnd":745.8000001907349,"connectStart":745.8000001907349,"domainLookupEnd":745.8000001907349,"domainLookupStart":745.8000001907349,"fetchStart":745.8000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":884.8999996185303,"responseEnd":915.6999998092651,"responseStart":913.8999996185303,"secureConnectionStart":745.8000001907349}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":43,"responseStart":208,"responseEnd":215,"domLoading":211,"domInteractive":945,"domContentLoadedEventStart":945,"domContentLoadedEventEnd":994,"domComplete":1294,"loadEventStart":1294,"loadEventEnd":1295,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":923.8000001907349},{"name":"bigPipe.sidebar-id.end","time":924.5999994277954},{"name":"bigPipe.activity-panel-pipe-id.start","time":924.8000001907349},{"name":"bigPipe.activity-panel-pipe-id.end","time":925.8000001907349},{"name":"activityTabFullyLoaded","time":1007}],"measures":[],"correlationId":"7f7e41f9255080","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":89,"dbReadsTimeInMs":17,"dbConnsTimeInMs":24,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}