Answer the question
In order to leave comments, you need to log in
How to speed up/cache the "SELECT MAX(updated_at) FROM `table`" query at the DB level?
mysql table:
CREATE TABLE `db`.`table` (
`id` INT(11) NOT NULL AUTO_INCREMENT ,
`updated_at` DATETIME NOT NULL ,
`name` VARCHAR(255) NOT NULL ,
PRIMARY KEY (`id`)
) ENGINE = InnoDB;
SELECT MAX(updated_at) FROM `table`
Answer the question
In order to leave comments, you need to log in
You can create an insert/delete trigger in a table and create a separate field with the maximum value for the field that will change upon insertion/deletion.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question