WPDiscuz slowing down my site  


Joshua
Posts: 9
Customer
(@weninrome)
Member
Joined: 2 years ago

Hello 

My server hosts have notified me of the following issue:

As you can see below, there are multiple concurrent queries for the same query parameters (same 'user_id' search), and each query takes over 2 seconds. I want to understand why this happening (there should only be 1 query, not multiple queries with the same parameters), 

Time: 2019-03-04T04:52:02.323104Z

User@Host: wp_nrlsctalk[wp_nrlsctalk] @ localhost [] Id: 5903

Query_time: 2.102812 Lock_time: 0.000050 Rows_sent: 0 Rows_examined: 142515

SET timestamp=1551675122;
SELECT comment_ID FROM wp_comments WHERE comment_type = 'private' AND comment_parent = 0 AND user_id = 46057;

Time: 2019-03-04T04:52:02.384026Z

User@Host: wp_nrlsctalk[wp_nrlsctalk] @ localhost [] Id: 5907

Query_time: 2.205697 Lock_time: 0.000049 Rows_sent: 0 Rows_examined: 142515

SET timestamp=1551675122;
SELECT comment_ID FROM wp_comments WHERE comment_type = 'private' AND comment_parent = 0 AND user_id = 46057;

Time: 2019-03-04T04:52:02.455034Z

User@Host: wp_nrlsctalk[wp_nrlsctalk] @ localhost [] Id: 5905

Query_time: 2.196140 Lock_time: 0.000056 Rows_sent: 0 Rows_examined: 142515

SET timestamp=1551675122;
SELECT comment_ID FROM wp_comments WHERE comment_type = 'private' AND comment_parent = 0 AND user_id = 46057;

Time: 2019-03-04T04:52:02.457939Z

User@Host: wp_nrlsctalk[wp_nrlsctalk] @ localhost [] Id: 5904

Query_time: 2.419714 Lock_time: 0.000049 Rows_sent: 0 Rows_examined: 142515

SET timestamp=1551675122;
SELECT comment_ID FROM wp_comments WHERE comment_type = 'private' AND comment_parent = 0 AND user_id = 46057;

3 Replies
Astghik
Posts: 3293
Admin
(@astghik)
Support Team
Joined: 2 years ago

Hi @weninrome,

wpDiscuz Private Comments add-on uses the native Wordpress  get_comments_number hook to display the comment count. In your case, it calls the  get_comments_number() function several times. The functions are being used to show the correct number of comments for each user. I mean the cases if there are private comments that needn't be included in the comments count. 

I suggest you remove the action using the code provided below, but in this case, there is a risk of displaying the whole comments count including the private comments:

remove_filter('get_comments_number', [$wpDiscuzPrivateComment, 'getCommentNumber'], 268);

You need to add the code in your active theme's function.php file. 

Reply
1 Reply
Joshua
Customer
(@weninrome)
Joined: 2 years ago

Member
Posts: 9

Hello, 

Would it just be better for me to disable one of the add on plugins instead? If so, which should I disable?

Reply
Astghik
Posts: 3293
Admin
(@astghik)
Support Team
Joined: 2 years ago

@weninrome,

You should disable the Private comments add-on. 

Reply
Share:
Green
Default
Pear
Black Emo
{green}:grinning:
{green}:wink:
{green}:face:
{green}:inlove:
{green}:sweaty:
{green}:surprised:
{green}:lovekiss:
{green}:laugh:
{green}:formalsmile:
{green}:displeased:
{green}:cool:
{green}:resent:
{green}:nerd:
{green}:screaming:
{green}:amazed:
{green}:sad:
{green}:deceitful:
{green}:starryeyes:
{green}:evil:
{green}:shocked:
{green}:tears:
{green}:sulky:
{green}:smile:
{green}:vomited:
{green}:hi:
{green}:afraid:
{green}:crazy:
{green}:rabid:
{green}:fighting:
{green}:nonoise:
{green}:blushed:
{green}:idontknow:
{green}:scared:
{green}:razz:
{green}:kiss:
{green}:eat:
{green}:shutmouth:
{green}:gape:
{green}:suspicious:
{green}:laughingoutloud:
{green}:bruise:
{green}:crying:
{green}:pray:
{green}:serious:
{green}:excitement:
:)
:d
:wink:
:mrgreen:
:neutral:
:twisted:
:arrow:
:shock:
:???:
:cool:
:evil:
:oops:
:razz:
:roll:
:cry:
:eek:
:lol:
:mad:
:sad:
:!:
:?:
:idea:
:hmm:
:beg:
:whew:
:chuckle:
:silly:
:envy:
:shutmouth:
{pear}:happy:
{pear}:smile:
{pear}:laugh:
{pear}:laughingoutloud:
{pear}:crying:
{pear}:exhausted:
{pear}:nerd:
{pear}:surprised:
{pear}:veryhungry:
{pear}:wink:
{blackemo}:laughtertotears:
{blackemo}:gift:
{blackemo}:love:
{blackemo}:inlove:
{blackemo}:shamefaced:
{blackemo}:heart:
{blackemo}:crazy:
{blackemo}:anguished:
{blackemo}:bruise:
{blackemo}:easymoney:
{blackemo}:exhausted:
{blackemo}:vampire:
{blackemo}:shutmouth:
{blackemo}:wink:
{blackemo}:carnival:
{blackemo}:flowers:
{blackemo}:hotdrink:
{blackemo}:party: