[buddypress-trac] [BuddyPress] #4060: slow queries in bp-core-classes

buddypress-trac at lists.automattic.com buddypress-trac at lists.automattic.com
Sun Mar 11 20:17:17 UTC 2012

#4060: slow queries in bp-core-classes
 Reporter:  shanebp       |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  1.6
Component:  Members       |     Version:  1.2.9
 Severity:  normal        |  Resolution:
 Keywords:                |

Comment (by boonebgorges):

 > seems like we're having a bit of an apples/oranges discussion.

 I don't think so. I'm just saying that we may be able to manage without
 creating a new table. The problem with the current last_activity
 implementation is not the join itself - it's the fact that (as you note)
 we ORDER BY meta_value, and the meta_value column is not indexed. The case
 is different with wp_bp_activity - we have a date_recorded column that
 *is* indexed. So putting the last_activity in that table would, in theory,
 be much faster than the current implementation in wp_usermeta.

 The only reason I bring up the issue of #4045 is because my logic here
 depends on the assumption that your wp_bp_activity table is already in
 good shape. Obviously, moving from the wp_usermeta implementation to the
 wp_bp_activity implementation wouldn't do much good if your activity table
 queries are slow too.

 This should be a fairly straightforward thing to test - we wouldn't really
 need to make any changes in BP for the benchmarking, just create the
 tables and try some different queries. I'm working on some related issues
 at the moment, so I will try to find some time to do it myself.

 In the meantime, if you find that the wp_usermeta thing really is a
 bottleneck, then you could create your own last_activity table, and filter
 the BP_Core_User queries to join against your own table instead of
 wp_usermeta. Obviously this is a bit more work than fixing it in BP
 itself, but it may take some time to get it sorted out in BP.

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

More information about the buddypress-trac mailing list