Notifications
Clear all

WPDiscuz slowing down my site

4 Posts
2 Users
0 Reactions
2,315 Views
Posts: 9
Customer
Topic starter
(@weninrome)
Member
Joined: 8 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: 6193
Admin
(@astgh)
Illustrious Member
Joined: 7 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
Customer
(@weninrome)
Joined: 8 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: 6193
Admin
(@astgh)
Illustrious Member
Joined: 7 years ago

@weninrome,

You should disable the Private comments add-on. 

Reply
Share:
Scroll to top