T O P I C R E V I E W |
modifichicci |
Posted - 05 July 2008 : 06:17:10 One of our users received a mail from the host saying that the routine SELECT Count( * ) AS PostCount FROM FORUM_REPLY R, FORUM_CATEGORY C, FORUM_FORUM F WHERE R.CAT_ID = C.CAT_ID AND C.CAT_MODERATION >0 AND R.FORUM_ID = F.FORUM_ID AND F.F_MODERATION IN ( 1, 3 ) AND R.R_STATUS >1
that is in inc_moderation take too many resources to db ( MySql )
I think it's the Count(*) that could give the problem. Can the * be changed to T.TOPIC_ID in the first occourence and to R.TOPIC_ID in the second without compromize the routine? < |
3 L A T E S T R E P L I E S (Newest First) |
modifichicci |
Posted - 05 July 2008 : 07:16:45 I don't know if the user has a clean mysql db install or a bad migration from access. In the second case that could be the problem, I think. No right indexes created and no correct default values. Ok thank you I will ask him to check indexes and default values in db and show him this post. Thank you again.
< |
ruirib |
Posted - 05 July 2008 : 07:02:16 Quite likely, adding a index to R_STATUS will result in a huge increase in performance.< |
HuwR |
Posted - 05 July 2008 : 06:53:54 The only time COUNT(*) vs COUNT(id) makes a difference is when your table does not have an index defined< |