I have a table with more than 300,000 rows (Total table size is 600mb+).
The rows on the table are records of events and each has a time stamp (epoch).
To perform a query on NOT expired events I have to use WHERE epoch > currentepoch, but it takes like 5-8 seconds to perform this kind of query. (In fact the number of NOT expired events are no more than 6,000)
So for a simple count of NOT expired events my query takes 5-8 seconds.
Is there any solutions to this? Can I query a part of the table? (Like ignoring the expired events and having MySQL not go trough them at all)
Note: Engine is MyISAM
Note2: I cannot normalize the table as the info are stuff like descriptions etc.
TLDR; Counting 6,000 rows out of a table of 300,000 rows takes 5-8 seconds, solutions?
Thanks
UPDATE: Thanks everyone. After adding an Index the query runs in less than half a second. Appreciate your help.
there is a thing called index for this purpose