Monica2003
asked on
Create index on "order by" parameter?
Hi,
I know that you should create indexes on the "where" parameters, but I was wondering if you should create indexes on the "order by" paramters. For example, in the query below, should I create an index on the "score" field?
select * from table where intl='us' and level='2' order by score;
Thanks for your help!
I know that you should create indexes on the "where" parameters, but I was wondering if you should create indexes on the "order by" paramters. For example, in the query below, should I create an index on the "score" field?
select * from table where intl='us' and level='2' order by score;
Thanks for your help!
if this query is called so many times in an hour, then , creating the index is not a bad option. You should not that, indexes wont always improves performance, it can only improves the perfromance during the retrieval operation
well, it will certainly help, otherwise the tree traversal (or the cost in short) for sorting will be much more.
ASKER
Should I create a composite index(intl, level, score) or two indexes: index(intl, level) and index(score)? Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I agree with Lowfatspread that the composite index will give the best performance