[buddypress-trac] [BuddyPress] #4060: Improve performance of BP_Core_User::get_users()

buddypress-trac at lists.automattic.com buddypress-trac at lists.automattic.com
Mon Aug 27 19:34:24 UTC 2012


#4060: Improve performance of BP_Core_User::get_users()
-------------------------------------------------+-------------------------
 Reporter:  shanebp                              |       Owner:
     Type:  enhancement                          |      Status:  new
 Priority:  highest                              |   Milestone:  1.7
Component:  Members                              |     Version:  1.2.9
 Severity:  critical                             |  Resolution:
 Keywords:  2nd-opinion has-patch needs-testing  |
  dev-feedback                                   |
-------------------------------------------------+-------------------------

Comment (by boonebgorges):

 Thanks for the cleanup, johnjamesjacoby.

 I agree that getting rid of the bp_is_active() checks would be nice to get
 rid of. Most of them could probably be dropped filtering the query_vars
 before assembling the SQL - this will allow components to modify the
 'include' and 'exclude' parameters using whatever queries they wish. Maybe
 we can look more closely at this once the base patch is committed - it's
 an optional enhancement for now, more for architectural elegance than any
 functional benefit.

 >  the queries are faster but it results in more of them (probably because
 of duplicate xprofile primary name field ID querying).

 Yes, and the fact that many JOINs were replaced with single table queries.
 This is case where more queries are *better*, because they're so much
 faster, and will be so much more cacheable by SQL cache.

 > I'm okay with the 'last_activity' behavior changing; it's something that
 comes up enough as unexpected where even though it's 'working as designed'
 it's still a poor design.

 This is going to raise enormous problems for backward compatibility. I'll
 open a separate enhancement ticket where we can talk about it. I don't
 want that issue to hold up these improvements.

 ===

 4060.03 fixes a couple of things:
 - Pulls 'meta_key'/'meta_value' queries into a separate query, to avoid
 all joins against wp_usermeta and wp_users (woo hoo!)
 - Implements the previously missing 'random' and 'popular' sort types
 - Switches the queries fired by the Members widget to use populate_extras,
 so that they get all the data they need. This change is required by some
 of the changes in the way the queries are built (we're no longer scooping
 up all metadata on the first query)

 IMO this is getting pretty close to being ready to rock.

-- 
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/4060#comment:30>
BuddyPress <http://buddypress.org/>
BuddyPress


More information about the buddypress-trac mailing list