Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 DEV-Group
 DEV Discussions (General)
 inc_moderation query
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

modifichicci
Average Member

Italy
787 Posts

Posted - 05 July 2008 :  06:17:10  Show Profile  Visit modifichicci's Homepage  Reply with Quote
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?
<

Ernia e Laparocele
Forum di Ernia e Laparocele
Acces - MySql Migration Tutorial
Adamantine forum

HuwR
Forum Admin

United Kingdom
20584 Posts

Posted - 05 July 2008 :  06:53:54  Show Profile  Visit HuwR's Homepage  Reply with Quote
The only time COUNT(*) vs COUNT(id) makes a difference is when your table does not have an index defined<
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 05 July 2008 :  07:02:16  Show Profile  Send ruirib a Yahoo! Message  Reply with Quote
Quite likely, adding a index to R_STATUS will result in a huge increase in performance.<


Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page

modifichicci
Average Member

Italy
787 Posts

Posted - 05 July 2008 :  07:16:45  Show Profile  Visit modifichicci's Homepage  Reply with Quote
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.

<

Ernia e Laparocele
Forum di Ernia e Laparocele
Acces - MySql Migration Tutorial
Adamantine forum
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.11 seconds. Powered By: Snitz Forums 2000 Version 3.4.07