MySQL Forums
Forum List  »  Optimizer & Parser

Re: Help Optimizing Query
Posted by: e h
Date: February 21, 2008 07:50PM

You're asking for the top 15 scores, correct. So create an index e.g.

CREATE INDEX score_idx ON scores (score,user_id);

An index allows you avoid a table scan and in addition it is maintained in key sorted order. Read the mysql docs on indexes, they are very informative.

Options: ReplyQuote


Subject
Views
Written By
Posted
3663
February 15, 2008 06:52PM
2379
February 17, 2008 09:13PM
Re: Help Optimizing Query
2324
e h
February 21, 2008 07:50PM


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.