I create and populate two tables as follows:
SET TIMESTAMP=UNIX_TIMESTAMP('2012-01-31 10:14:35');
|
DROP TABLE IF EXISTS t1, t2;
|
CREATE TABLE t1 (col_time_key TIME, KEY(col_time_key));
|
CREATE TABLE t2 (col_datetime_key DATETIME);
|
INSERT INTO t1 VALUES ('-760:00:00'),('760:00:00');
|
INSERT INTO t1 VALUES ('-770:00:00'),('770:00:00');
|
INSERT INTO t2 SELECT * FROM t1;
|
Now I run this query with IGNORE INDEX, it returns four rows as expected:
SELECT * FROM t2 STRAIGHT_JOIN t1 IGNORE INDEX(col_time_key) WHERE col_time_key = col_datetime_key;
|
+---------------------+--------------+
|
| col_datetime_key | col_time_key |
|
+---------------------+--------------+
|
| 2011-12-30 08:00:00 | -760:00:00 |
|
| 2012-03-02 16:00:00 | 760:00:00 |
|
| 2011-12-29 22:00:00 | -770:00:00 |
|
| 2012-03-03 02:00:00 | 770:00:00 |
|
+---------------------+--------------+
|
Now I run the same query but with FORCE INDEX, it erroneously returns three rows:
SELECT * FROM t2 STRAIGHT_JOIN t1 FORCE INDEX (col_time_key) WHERE col_time_key = col_datetime_key;
|
+---------------------+--------------+
|
| col_datetime_key | col_time_key |
|
+---------------------+--------------+
|
| 2011-12-30 08:00:00 | -760:00:00 |
|
| 2012-03-02 16:00:00 | 760:00:00 |
|
| 2012-03-03 02:00:00 | 770:00:00 |
|
+---------------------+--------------+
|
There are no comments yet on this issue.
{"report":{"fcp":1563.1999998092651,"ttfb":651.5,"pageVisibility":"visible","entityId":65812,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"699a979b-1a02-4e56-b2fe-e5fba0c9de4b","navigationType":0,"readyForUser":1659.9000005722046,"redirectCount":0,"resourceLoadedEnd":1378.6000003814697,"resourceLoadedStart":664.6000003814697,"resourceTiming":[{"duration":262.5,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bv2/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":664.6000003814697,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":664.6000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":927.1000003814697,"responseStart":0,"secureConnectionStart":0},{"duration":263.29999923706055,"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":664.9000005722046,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":664.9000005722046,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":928.1999998092651,"responseStart":0,"secureConnectionStart":0},{"duration":427,"initiatorType":"script","name":"https://jira.mariadb.org/s/e9b27a47da5fb0f74a35acd57e9847fb-CDN/lu2bv2/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":665.1000003814697,"connectEnd":665.1000003814697,"connectStart":665.1000003814697,"domainLookupEnd":665.1000003814697,"domainLookupStart":665.1000003814697,"fetchStart":665.1000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":936.8000001907349,"responseEnd":1092.1000003814697,"responseStart":950.3000001907349,"secureConnectionStart":665.1000003814697},{"duration":576.6999998092651,"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":665.3000001907349,"connectEnd":665.3000001907349,"connectStart":665.3000001907349,"domainLookupEnd":665.3000001907349,"domainLookupStart":665.3000001907349,"fetchStart":665.3000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":937.1000003814697,"responseEnd":1242,"responseStart":952.4000005722046,"secureConnectionStart":665.3000001907349},{"duration":295.69999980926514,"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":665.4000005722046,"connectEnd":665.4000005722046,"connectStart":665.4000005722046,"domainLookupEnd":665.4000005722046,"domainLookupStart":665.4000005722046,"fetchStart":665.4000005722046,"redirectEnd":0,"redirectStart":0,"requestStart":944.1000003814697,"responseEnd":961.1000003814697,"responseStart":958.9000005722046,"secureConnectionStart":665.4000005722046},{"duration":296.30000019073486,"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":665.6000003814697,"connectEnd":665.6000003814697,"connectStart":665.6000003814697,"domainLookupEnd":665.6000003814697,"domainLookupStart":665.6000003814697,"fetchStart":665.6000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":945,"responseEnd":961.9000005722046,"responseStart":959.9000005722046,"secureConnectionStart":665.6000003814697},{"duration":297.3999996185303,"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":665.8000001907349,"connectEnd":665.8000001907349,"connectStart":665.8000001907349,"domainLookupEnd":665.8000001907349,"domainLookupStart":665.8000001907349,"fetchStart":665.8000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":947.1999998092651,"responseEnd":963.1999998092651,"responseStart":962.1000003814697,"secureConnectionStart":665.8000001907349},{"duration":280.5999994277954,"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":665.9000005722046,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":665.9000005722046,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":946.5,"responseStart":0,"secureConnectionStart":0},{"duration":298.4000005722046,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":666.1999998092651,"connectEnd":666.1999998092651,"connectStart":666.1999998092651,"domainLookupEnd":666.1999998092651,"domainLookupStart":666.1999998092651,"fetchStart":666.1999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":948.6999998092651,"responseEnd":964.6000003814697,"responseStart":963.4000005722046,"secureConnectionStart":666.1999998092651},{"duration":281.29999923706055,"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":666.4000005722046,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":666.4000005722046,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":947.6999998092651,"responseStart":0,"secureConnectionStart":0},{"duration":300.19999980926514,"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":666.6000003814697,"connectEnd":666.6000003814697,"connectStart":666.6000003814697,"domainLookupEnd":666.6000003814697,"domainLookupStart":666.6000003814697,"fetchStart":666.6000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":949.6999998092651,"responseEnd":966.8000001907349,"responseStart":965.3000001907349,"secureConnectionStart":666.6000003814697},{"duration":615.8999996185303,"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":669.9000005722046,"connectEnd":669.9000005722046,"connectStart":669.9000005722046,"domainLookupEnd":669.9000005722046,"domainLookupStart":669.9000005722046,"fetchStart":669.9000005722046,"redirectEnd":0,"redirectStart":0,"requestStart":1184.4000005722046,"responseEnd":1285.8000001907349,"responseStart":1282.1999998092651,"secureConnectionStart":669.9000005722046},{"duration":708.6999998092651,"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":669.9000005722046,"connectEnd":669.9000005722046,"connectStart":669.9000005722046,"domainLookupEnd":669.9000005722046,"domainLookupStart":669.9000005722046,"fetchStart":669.9000005722046,"redirectEnd":0,"redirectStart":0,"requestStart":1367.1000003814697,"responseEnd":1378.6000003814697,"responseStart":1377.6000003814697,"secureConnectionStart":669.9000005722046},{"duration":212.4000005722046,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":1222.5,"connectEnd":1222.5,"connectStart":1222.5,"domainLookupEnd":1222.5,"domainLookupStart":1222.5,"fetchStart":1222.5,"redirectEnd":0,"redirectStart":0,"requestStart":1377.5,"responseEnd":1434.9000005722046,"responseStart":1433.1000003814697,"secureConnectionStart":1222.5},{"duration":257.69999980926514,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":1499.9000005722046,"connectEnd":1499.9000005722046,"connectStart":1499.9000005722046,"domainLookupEnd":1499.9000005722046,"domainLookupStart":1499.9000005722046,"fetchStart":1499.9000005722046,"redirectEnd":0,"redirectStart":0,"requestStart":1705.9000005722046,"responseEnd":1757.6000003814697,"responseStart":1756.1000003814697,"secureConnectionStart":1499.9000005722046}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":484,"responseStart":652,"responseEnd":668,"domLoading":661,"domInteractive":1758,"domContentLoadedEventStart":1759,"domContentLoadedEventEnd":1807,"domComplete":2438,"loadEventStart":2438,"loadEventEnd":2439,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1738.8000001907349},{"name":"bigPipe.sidebar-id.end","time":1739.5},{"name":"bigPipe.activity-panel-pipe-id.start","time":1739.6999998092651},{"name":"bigPipe.activity-panel-pipe-id.end","time":1740.1999998092651},{"name":"activityTabFullyLoaded","time":1822.5}],"measures":[],"correlationId":"7eeaaf8b10fc6f","effectiveType":"4g","downlink":9.2,"rtt":0,"serverDuration":88,"dbReadsTimeInMs":10,"dbConnsTimeInMs":18,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}