Skip to:
Content

#7515 closed defect (bug)

Inefficient db query

Reported by: sourfew Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.2
Component: Core Keywords:
Cc:

Description

Very slow db query for logged out users on all pages.

Wordpress: 4.7.3
Buddypress: 2.8.2
bbpress: 2.6b2
25000 users

With QueryMonitor I can see the following
SELECT wp_users.ID,wp_users.user_login,wp_users.user_pass,wp_users.user_nicename,wp_users.user_email,wp_users.user_url,wp_users.user_registered,wp_users.user_activation_key,wp_users.user_status,wp_users.display_name
FROM wp_users
WHERE 1=1
AND wp_users.ID IN (40269,32606,34524,34322,40331,40334,36153,25677… and all 25000 user id’s

Caller is WP_User_Query->query()
wp-includes/class-wp-user-query.php:600

Component:
Plugin buddypress

Change History (6)

#1 @boonebgorges
14 months ago

  • Keywords reporter-feedback added; needs-patch removed

Can you please give a complete stack trace? I don't believe there's any reason that BuddyPress would be querying for all users.

Can you also share information about your theme and the BP plugins that you're running?

#2 @slaFFik
14 months ago

At-mention functionality in activity's "what's new" textarea (and other places, even on post-new.php in wp-admin)?

#3 @r-a-y
14 months ago

At-mention functionality in activity's "what's new" textarea

See #7487. We should probably close this ticket for that one.

What the OP mentions is odd because if the at-mentions prime functionality is the cause, it should only happen for logged-in users.

Last edited 14 months ago by r-a-y (previous) (diff)

#4 @sourfew
14 months ago

Thanks, I followed the support thread to turn off mentions for logged out users and that worked fine.
I can't see how that is related to the limit of 150 and why it works for logged in users.

#5 @r-a-y
14 months ago

  • Keywords reporter-feedback removed
  • Milestone Awaiting Review deleted
  • Version changed from 2.8.2 to 2.2

Thanks, I followed the support thread to turn off mentions for logged out users and that worked fine.

The mentions script only runs for active users:
https://buddypress.trac.wordpress.org/browser/tags/2.8.2/src/bp-friends/bp-friends-functions.php?marks=776-778#L766
https://buddypress.trac.wordpress.org/browser/tags/2.8.2/src/bp-activity/bp-activity-functions.php?marks=66#L57
https://buddypress.trac.wordpress.org/browser/tags/2.8.2/src/bp-members/bp-members-functions.php?marks=1083,1090-1093#L1075

So it is possible that you are running a code snippet that is trying to enable this for logged-out users somewhere.

Going to close this as a duplicate of #7487.

If you have any other things to add to duplicate the issue for logged-out users, let us know.

#6 @tw2113
13 months ago

  • Status changed from new to closed

Closing as duplicate of #7487

Note: See TracTickets for help on using tickets.