Shouldn't wp_usermeta have unique (user_id,meta_key) ?
-
I just altered my wp_usermeta like so:
alter table wp_usermeta add unique index unique_id_key (user_id,meta_key);
and mysql did not complain of duplicates. Which, of course, indicates, that there aren’t any.
So, I realize the idea is that the php code should make sure there aren’t duplicate entries, but why not ensure it on the MySQL level?
I’m not sure if the “unique index” in particular causes a database performance hit. I don’t think it does, for reading, at least (maybe for writing — inserting/updating the indexed columns)
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Shouldn't wp_usermeta have unique (user_id,meta_key) ?’ is closed to new replies.