Hey all,
I have a query like this one:
select * from topic order by topic_view_time limit 10

the topic table has a PK topic_id and some other varchar fields. It also has topic_view_time which is int and has the value of time() (in php) updated whenever a user view the topic.
In case of 1 Million rows, I think that this query must be slow.
And I also think the problem is because I am ordering by a non index field.
How can I improve the query to execute faster.
Please note: I can't make topic_view_time unique since multiple users may view different topics at the exact same time.

Thank you :)

4 Years
Discussion Span
Last Post by pritaeas
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.