Say I have a table called "posts" with thousands of records. For each user, I want to display the top 10 most recent posts.
I would normally use:
select * from posts order by created_date desc limit 10
However, doesn't this select ALL records and then removes all but the top 10. For a huge database, this wouldn't be efficient.
Can anyone suggest an alternative?