Bug #7725 Indexed DATETIME Columns Return Random Results
Description:
This may be related to #7424.
The NDB nodes are running on Red Hat ES on Dual Xeon EMT_64 servers with 4gb of RAM each.
Our tables have DATETIME columns, which are frequently searched. When no index is defined for a DATETIME column, MAX(), MIN(), ORDER BY, <, and > operators behave correctly.
When an index is defined, the above operations return incorrect results. MAX(), MIN(), <, and > returns rows that are not the maximum or minimum of the dataset, or rows that are not greater than or less than the value specified in the WHERE clause.
How to repeat:
CREATE TABLE `PageData` ( `PageID` bigint(20) unsigned NOT NULL default '0', `StartLineNumber` bigint(20) unsigned NOT NULL default '0', `EndLineNumber` bigint(20) unsigned NOT NULL default '0', `StartDateTime` datetime NOT NULL default '0000-00-00 00:00:00', `EndDateTime` datetime NOT NULL default '0000-00-00 00:00:00', `StationID` smallint(5) unsigned NOT NULL default '0', PRIMARY KEY (`PageID`), KEY `EndDateTime` (`EndDateTime`)) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
CREATE TABLE `PageDataMyISAM` ( `PageID` bigint(20) unsigned NOT NULL default '0', `StartLineNumber` bigint(20) unsigned NOT NULL default '0', `EndLineNumber` bigint(20) unsigned NOT NULL default '0', `StartDateTime` datetime NOT NULL default '0000-00-00 00:00:00', `EndDateTime` datetime NOT NULL default '0000-00-00 00:00:00', `StationID` smallint(5) unsigned NOT NULL default '0', PRIMARY KEY (`PageID`), KEY `EndDateTime` (`EndDateTime`)) ENGINE=MYISAM DEFAULT CHARSET=latin1;
[load test data set into each table by redirecting a file of INSERTs into mysql command line tool]
Running SELECT MIN(EndDateTime),MAX(EndDateTime) FROM PageData; and SELECT MIN(EndDateTime),MAX(EndDateTime) FROM PageDataMyISAM; produce different results.
Result from SELECT * FROM PageData ORDER BY EndDateTime DESC; produces randomly ordered rows.
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.051 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.