I have a table with two fields; id and timestamp. I want to get the
20 last records for one ID, e.g.
select * from tbl where id=12 order by timestamp desc limit 20;
Then mysql uses a file sort, and that slows things down far to much to
be acceptable if there are many records with an id.
Any hope for a negative limit, e.g.
select * from tbl where id=12 use index myind limit -30;
or do I have to fake a timestamp field that decreases with time?
Or are there other ways to do this?
--
Regards, Rune Kleveland