Contents
How to add index to meta _ value in WP _ postmeta?
I have about 5 million rows in the wp_postmeta table and my queries takes about 3 seconds when limited to 500 rows. I am trying to do add an index to meta_value in phpMyAdmin but i am getting an error message saying:
How to query WP postmeta in MySQL?
JOIN wp_postmeta AS m ON p.id = m.post_id WHERE m.meta_key = ‘…’ The composite PRIMARY KEY goes straight to the desired row, no digression through secondary index, nor search through multiple rows.
Is the GET POST meta function case sensitive?
Please note that if a db collation is case insensitive (has with suffix _ci) then update_post_meta and delete_post_meta and get_posts () will update/delete/query the meta records with keys that are upper or lower case. However get_post_meta will apparently be case sensitive due to WordPress caching.
Is the post meta table the wrong place?
If you are looking for DB performance “out of the box”, then the post meta table is the wrong place to store things that you will want to search for. The way you describe your query it will be much better to use a taxonomy for that usage case.
What do you need to know about post meta?
WordPress permits you to store multiple rows of the same post meta for a single post, so you can get an array of data without needing to serialize it and store it in one key. To do this, you need to slightly change how you’re interacting with the post meta api here. Something like this is what you’d want:
Can you store multiple rows of post meta in WordPress?
WordPress permits you to store multiple rows of the same post meta for a single post, so you can get an array of data without needing to serialize it and store it in one key. To do this, you need to slightly change how you’re interacting with the post meta api here.
How big is the meta value of WP attachment metadata?
I was thinking of converting it to varchar (255) but i have a meta value of _wp_attachment_metadata that is around 1500 characters long. Don’t limit the field, instead, limit the index, e.g. This limits the index to the first hundred bytes of meta_value. You’ll probably want an index on post_id, meta_key, meta_value for joins.