Rate this article :
5/5 | 3 opinion
This article was useful to you ?
Yes
No
Vous avez noté 0 étoile(s)
Sommaire
Procédure
If you've been using WordPress for a while, it's likely that your wp_postmeta table is a significant size.
This article will explain how to clear the wp_postmeta table in order to reduce the size of your WordPress database.
To reduce the size of the wp_postmeta table, you will need to execute MySQL queries. To execute these queries, you need to connect to PhpMyAdmin, then click on the SQL tab, paste the desired query into the field and press the Execute button.
DELETE FROM `wp_posts` WHERE `post_type`="revision"
DELETE FROM `wp_posts` WHERE `post_status`="trash"
DELETE m FROM `wp_postmeta` AS m LEFT JOIN `wp_posts` AS p ON m.`post_id` = p.`ID` WHERE p.`ID` IS NULL
SELECT DISTINCT meta_key FROM `wp_postmeta` SELECT DISTINCT meta_key FROM `wp_postmeta`
The query above is not a table cleanup query.
You can use it to obtain a list of meta-keys in order to remove unused data from your database.
The following queries explain how to delete this data.
DELETE FROM `wp_postmeta` WHERE `meta_key` LIKE '%PLUGIN_NAME%'.
to replace PLUGIN_NAME by one of the values obtained in the previous request.
Once you have used these queries to clean up the wp_postmeta table you can calculate the new size of the table using the query below:
SELECT (SUM(DATA_LENGTH + INDEX_LENGTH))/1048567 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'wp_postmeta';
You can now clean up the wp_postmeta table to reduce the size of your Mysql database.
This will allow you to remove unnecessary data from your database and thus reduce its size.
Don't hesitate to contact our technical department via an incident ticket if you have any questions.
Rate this article :
5/5 | 3 opinion
This article was useful to you ?
Yes
No
1mn reading
How does Yoast SEO work?
4mn reading
How can you optimise your Wordpress site?
1mn reading
How do I use Gutenberg on Wordpress?
2mn reading
How do I disable the Gutenberg editor on Wordpress?