Move user and group last_activity out of wp_usermeta
|Reported by:||boonebgorges||Owned by:|
See https://buddypress.trac.wordpress.org/ticket/4060#comment:3 and ensuing discussion for some background.
BP does lots of sorting and filtering by users' (and to some extent groups', though users are much more problematic and important) 'last_activity' meta value. But this scales very poorly, as the wp_usermeta table is very much not designed for this kind of thing. The changes introduced by BP_User_Query help by removing some of the worst-offending JOINs, but the fundamental problem remains: last_activity data should be stored somewhere where it can be properly indexed and typed, so that queries and sorts are reasonably fast.
My initial proposal is that we move last_activity to the bp_activity table, which is already structured properly. (There are two other possibilities that I might also explore: adding a column to the wp_users table and adding a separate last_activity table.)
- backward compatibility. Should we sync back to last_activity just for this purpose?
- If moving into bp_activity, we'll need that component, or at least a minimal subset of it, to be active at all times
I'll work up a proof-of-concept soon, and try to run some benchmarks to show that it's worthwhile. Thoughts and feedback welcome in the meantime.
Change History (33)
3 years ago
- Keywords has-patch needs-testing added