[buddypress-trac] [BuddyPress] #4104: wp_bp_activity stores item_id and secondary_item_id as VARCHAR; breaks indexes

buddypress-trac at lists.automattic.com buddypress-trac at lists.automattic.com
Thu Mar 29 21:50:39 UTC 2012


#4104: wp_bp_activity stores item_id and secondary_item_id as VARCHAR; breaks
indexes
--------------------------+-----------------
 Reporter:  boonebgorges  |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  1.6
Component:  Activity      |    Version:
 Severity:  major         |   Keywords:
--------------------------+-----------------
 The `item_id` and `secondary_item_id` columns in `wp_bp_activity` are
 `varchar(75)`. This is bad in a couple of ways:

 - When querying on a specific item/secondary item, our query class casts
 the items to int (in clauses like `WHERE a.item_id IN ( 5,8,20 )`). The
 type mismatch between our query and the column means that MySQL can't use
 its indexes and has to do a full tablescan.
 - varchar is less efficient when an integer type would work
 - We're casting to int before writing to the activity table anyway

 Should just be able to change the table definition and let `dbDelta()` do
 its work, but this will need some testing.

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


More information about the buddypress-trac mailing list