[buddypress-trac] [BuddyPress Trac] #8591: Improve query that runs to find total activities count in spam activity table

buddypress-trac noreply at wordpress.org
Tue Oct 26 21:58:06 UTC 2021


#8591: Improve query that runs to find total activities count in spam activity
table
-------------------------+------------------------------
 Reporter:  oztaser      |       Owner:  (none)
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  (not sure)   |     Version:
 Severity:  normal       |  Resolution:
 Keywords:               |
-------------------------+------------------------------

Comment (by oztaser):

 I am not sure is it the best way but we can simply pass the `per_page`
 parameter to function. The other way maybe we can create some function
 that runs count query grouped by `is_spam`.

 What is your suggestions?

 I've prepared a MySQL procedure for creating test data, it may help if you
 want to create dummy activity records.

 {{{
 CREATE PROCEDURE insert_activities()
 BEGIN
         SET @i = 1;
         insert_loop: LOOP
         SET @i = @i + 1;
                 insert into wordpress.wp_bp_activity
 (`user_id`,`component`,`type`,`item_id`,`primary_link`,`date_recorded`,`action`,`content`)
 values(1,
 'activity','activity_update',0,'http://localhost:8888/members/admin/',now(),'posted
 update','some activity');

         IF @i <= 1000000 THEN
           ITERATE insert_loop;
         END IF;
         LEAVE insert_loop;
         END LOOP insert_loop;
 END;

 call insert_activities()
 }}}

-- 
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/8591#comment:1>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list