MySQL Forums
Forum List  »  MyISAM

Re: Almost whole table in single index: is there a better way?
Posted by: Aftab Khan
Date: August 27, 2012 11:02AM

>EXPLAIN SELECT SensorTime,Value FROM RemoteStatuses WHERE SensorID = 525 AND DataID = 110 AND SensorTime BETWEEN 1346083196-86400*7 AND 1346083196

SQL looks different from the original SQL?

EXPLAIN SELECT SensorTime,Value FROM RemoteStatuses WHERE RemoteID = X AND DataID = Y AND SensorTime BETWEEN A AND B \G

> RemoteID vs SensorID
Column SensorID doesn't exist in provided table structure?
CREATE TABLE `RemoteStatuses` ( 
`RemoteID` int(11) NOT NULL, 
`SensorTime` int(11) NOT NULL, 
`DataID` smallint(6) NOT NULL, 
`Value` char(8) NOT NULL, 
PRIMARY KEY (`RemoteID`,`DataID`,`SensorTime`) 
) ENGINE=MyISAM DEFAULT CHARSET=latin1 

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

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.