I'm currently utilizing the wp_woocommerce_order_itemmeta
table in WordPress (set up similarly to wp_postmeta
). This table has four fields:
id
order_item_id
meta_key
meta_value
I've got a situation where I need to make sure meta_values for certain meta_keys are unique. E.g. ticket numbers (same ticket number can't be issued twice).
I know it's possible to use multiple-column indexes with unique constraints:
- Understanding multiple column indexes in MySQL query
- How do I specify unique constraint for multiple columns in MySQL?
My question is: would adding such a constraint affect performance or have any weird side-effects in WordPress that anyone can think of?