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 :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.