[buddypress-trac] [BuddyPress] #4045: Activity Feed queries fail with millions of rows

buddypress-trac at lists.automattic.com buddypress-trac at lists.automattic.com
Tue Apr 17 21:22:51 UTC 2012


#4045: Activity Feed queries fail with millions of rows
-----------------------------------+--------------------
 Reporter:  zacechola              |       Owner:
     Type:  defect (bug)           |      Status:  new
 Priority:  normal                 |   Milestone:  1.6
Component:  Activity               |     Version:  1.5.4
 Severity:  normal                 |  Resolution:
 Keywords:  2nd-opinion has-patch  |
-----------------------------------+--------------------

Comment (by boonebgorges):

 OK, I have worked up a patch that allows for disabling activity counts.
 4045.03.patch does the following:

 - Introduces a `do_total_count` parameter to the `bp_has_activities()`
 stack. It defaults to `true`. When set to `false`, the COUNT query will be
 skipped, and the `total` key (where the count usually goes) will be set to
 `-1`.
 - Introduces a `'bp_activity_allow_total_count'` filter, which allows
 admins/plugins to override the `do_total_count` filter in a global way.
 (It's not strictly necessary to have the parameter *and* this filter, but
 for testing it makes it slicker.)
 - Reworks the pagination links code in BP_Activity_Template, so that
 noscript pagination works (minimally) when the total activity count is -1.
 Note that my solution here is not really beautiful (swap out the numbers
 for Previous and Next links), but it's functional, and I'm guessing that
 any site using BP at the kind of scale we're talking about here will want
 to implement a custom noscript solution anyway

 4045.03.patch is against trunk r5994. To test, apply the patch, and drop
 the following into your bp-custom.php:
 {{{
     add_filter( 'bp_activity_allow_total_count', '__return_false' );
 }}}

 As expected, on large installations, it cuts down page load time by dozens
 of seconds.

 Feedback welcome.

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


More information about the buddypress-trac mailing list