#4104 closed defect (bug) (fixed)
wp_bp_activity stores item_id and secondary_item_id as VARCHAR; breaks indexes
Reported by: | boonebgorges | Owned by: | |
---|---|---|---|
Milestone: | 1.6 | Priority: | normal |
Severity: | major | Version: | |
Component: | Activity | Keywords: | has-patch needs-testing |
Cc: |
Description
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.
Attachments (1)
Change History (6)
Note: See
TracTickets for help on using
tickets.
4104.01.diff changes the schema and bumps the db number to prompt an upgrade. Looks good on my local, but I would like a second opinion before committing.