I have a table exchange
CREATE TABLE `exchange` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`rank` int(11) NOT NULL,
`name` varchar(255) NOT NULL,
`volume` varchar(255) NOT NULL,
`timestamp` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=75032 DEFAULT CHARSET=utf8;
every 5 minutes, a record of data is recorded, about 209 items at a time, which is the trading volume of 209 digital currency exchanges at the current time.
I expect to find data like this:
rank name [volume (latest 144values)] timestamp
the stupid way I take now is to look it up one by one,
get the list of exchanges
one by one
select volume from exchange where exchange.name="binance" order by timestamp
DESC limit 144s
performance overhead is very high, would like to ask, is there a better way?