MySQL Forums
Forum List  »  Newbie

Re: Specifying multiple WHERE options within a group?
Posted by: Jay Pipes
Date: July 11, 2005 07:50AM

OK, the reason that the query is performing so poorly is because you have no indexes on the columns used in your query's WHERE and ON conditions. You should create an index on UserID and Action, like so:

CREATE INDEX idx_UserAction ON TrackingActions (UserId, Action);

Then re-run the EXPLAIN from above.

Also, I would recommend condensing the Action field data into a smaller tinyint data type, with a lookup table for the long description of the action. This will significantly improve the query speed, as more index records will fit into a single 1KB index block for the index you created...

Cheers,

Jay Pipes
Community Relations Manager, North America, MySQL Inc.

Got Cluster? http://www.mysql.com/cluster
Personal: http://jpipes.com

Options: ReplyQuote




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.