Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Snitz Forums 2000 DEV-Group
 DEV Discussions (General)
 inc_moderation query

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!
Before posting, make sure you have read this topic!

Screensize:
UserName:
Password:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert EmailInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
   

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<

Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.04 seconds. Powered By: Snitz Forums 2000 Version 3.4.07