Answer the question
In order to leave comments, you need to log in
The wp_postmeta table is over 1 gig, what should I do?
Guys, probably the table wp_postmeta
in Wordpress is a real headache!
I have 214677 entries in it and it weighs 1.5 GiB (I use the InnoDB engine and utf8mb4_unicode_520_ci encoding). At the same time, there are wp_woocommerce_order_itemmeta
310731 records in the table and it weighs 34.6 MB .
Tried to clean manually, removed all `meta_value` = '', but this is a temporary solution. I also deleted all entries for non-existent posts (compared the presence of ids in the wp_posts and wp_postmeta tables, there is no post - we delete meta data as well) - it turned out to be only 78 posts.
All in all, not much has been removed. Perhaps there are some plugins or smarter SQL queries?
On average, the site loads in 0.801934 seconds with 33 database queries (first load) and 0.592067 seconds with 27 database queries (repeated). The site has over 2,000 products and 18,000 WooCommerce orders.
This is how the tables look now:
Therefore, the following questions arose:
Answer the question
In order to leave comments, you need to log in
Last night, just in the telegram channel, a question was asked :)
SELECT meta_key, meta_value, length(meta_value)
FROM wp_postmeta
ORDER BY length(meta_value) DESC
LIMIT 10;
Try sorting the table by row weight and see which rows are the heaviest and what is stored in them.
You can also look at some plugin ala https://uk.wordpress.org/plugins/advanced-database...
As advised: check what metadata you have stored. Perhaps some plugin or something else creates a bunch of entries for each post.
In general, I would ignore the situation. You do not have all the metadata loaded at a time. But I'm not a database expert.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question