MySQL Forums
Forum List  »  Performance

Re: Very slow query for no apparent reason
Posted by: Rick James
Date: December 12, 2010 01:28PM

"are you suggesting to define the second index with the 3 fields? " -- yes:
ALTER TABLE stats_sit
    ADD INDEX(matrixID, agg_time, end_time);

"As for the stats_filesystem, there is no where cause there is one line.
Is that a problem?" -- Eh? I see a WHERE clause. Are you saying there is only one line in the table? If so, then the presence/absence of a WHERE clause makes no difference (unless the WHERE clause does not match the one row).

Quote

As for the alerts-links, what do you mean by:
Ouch! There is nothing tying the two table together! ??
Are you referring to a foreign key not defined between them?
You must still tie the two tables together with a WHERE clause or (better) a ON clause. Otherwise, you get a 'cross join', which is orders of magnitude slower than what you expect.

Options: ReplyQuote


Subject
Views
Written By
Posted
5119
December 02, 2010 06:45AM
Re: Very slow query for no apparent reason
1272
December 12, 2010 01:28PM


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.