Help Optimizing Query
Hi,
I'm trying to optimise a few of my queries but having no luck at all so am looking for some help. First, here is the table structures....
scores (1,500,000+ records)
user_id int(11)
score int(11)
users (750,000+ records)
id mediumint(8)
username varchar(32)
And the query I'm trying to run....
SELECT sum( score ) AS score, username
FROM scores s, users u
WHERE s.user_id = u.id
GROUP BY s.user_id
ORDER BY score DESC
LIMIT 15
Is there a way I can streamline it? Using indexes etc or is the way I've set out the query not right or something? It currently reads every row for the scores table.
Cheers.
Subject
Views
Written By
Posted
Help Optimizing Query
3662
February 15, 2008 06:52PM
2378
February 17, 2008 09:13PM
2324
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.