[buddypress-trac] [BuddyPress] #3972: Database query needs optimization - BP_Core_User->get_users

buddypress-trac at lists.automattic.com buddypress-trac at lists.automattic.com
Tue Jan 31 19:52:19 UTC 2012


#3972: Database query needs optimization - BP_Core_User->get_users
----------------------------+-----------------------------
 Reporter:  arpit.tambi.in  |      Owner:
     Type:  enhancement     |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  Core            |    Version:  1.5.3
 Severity:  normal          |   Keywords:
----------------------------+-----------------------------
 When a website has large number of users (busy site), the database queries
 made by get_users function in BP_Core_User class take much longer to
 execute and CPU really spikes up bringing the entire website down. This
 class is located in bp-core-classes.php

 Here is the sample info from mysql slow log

 {{{
 # Query_time: 27  Lock_time: 3  Rows_sent: 1  Rows_examined: 154595
 SELECT COUNT(DISTINCT u.ID) FROM wp_users u LEFT JOIN wp_usermeta um ON
 um.user_id = u.ID LEFT JOIN wp_bp_xprofile_data spd ON u.ID = spd.user_id
 WHERE u.user_status = 0 AND um.meta_key = 'last_activity' AND spd.value
 LIKE '%%United States%%' ORDER BY u.ID DESC;
 }}}

-- 
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/3972>
BuddyPress <http://buddypress.org/>
BuddyPress


More information about the buddypress-trac mailing list