in reply to Re: (OT) Improving a SQL JOIN statement
in thread (OT) Improving a SQL JOIN statement
Just select from ratinglist without the join, try the select once with just an index on ratinglist.itemid, once with an index on category, and once with just a composite index on categoryid, itemid (this seems to be the ideal index for this select, but might be unneccessary). Or create all the indexes, do an explain plan, and see which index is selected.
For the composite index, you might have to include category in both the select and the group by clause. Then again, the order by may be killing your query in which case there's not a whole lot SQL wise you can do about it, though maybe from a database tuning perspective you can.
Update: In the case that you do need some fields from itemlist, I'd consider making it a separate sql statement ('select ..stuff.. where itemid = ?') rather than a join, it may or may not improve things.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: (OT) Improving a SQL JOIN statement
by Masem (Monsignor) on Apr 10, 2001 at 20:49 UTC |