MySQL Forums
Forum List  »  Performance

Index on 2 columns
Posted by: Tristan Croiset
Date: March 15, 2005 05:21PM

I have a table with 2 INT fields (n_id PRIMARY, n_category).

Considering this kind of query :
SELECT n_id, n_category, n_title
FROM news
WHERE n_id <=20035
AND n_category
IN ( 2, 17, 45, 23, 18 )
ORDER BY n_id DESC
LIMIT 1 , 6

What's the best Index I should use ?

I firstly thought to create a index on 2 columns (n_id then n_category) but I wonder if it will be really usefull and if the best index for this query is just the primary on n_id.

Thanks

Options: ReplyQuote


Subject
Views
Written By
Posted
Index on 2 columns
2922
March 15, 2005 05:21PM
1442
March 17, 2005 08:45AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.