Perhaps something like the following:
SELECT * FROM your_table
ORDER BY your_timestamp DESC
LIMIT 10
If you want the result to be sorted by timestamp, you can wrap this in another query and sort it again. You can take a look at the implementation plan, but it should not be too inefficient.
source
share