• Hi,

    After transferring from a VPS to another I uploaded xml files from WordPress Importer plugin and restored posts, pages and others. However wp_postmeta has 1,5 million rows and it is 335 MB! The plugin named WP-optimize says “No orphaned post meta data in your database” I used these 2 codes below but nothing changed. How can I fix this without losing any information?

    DELETE pm
    FROM wp_postmeta pm
    LEFT JOIN wp_posts wp ON wp.ID = pm.post_id
    WHERE wp.ID IS NULL

    SELECT * FROM wp_postmeta pm LEFT JOIN wp_posts wp ON wp.ID = pm.post_id WHERE wp.ID IS NULL;
    DELETE pm FROM wp_postmeta pm LEFT JOIN wp_posts wp ON wp.ID = pm.post_id WHERE wp.ID IS NULL;

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    How many posts do you have? Have you removed all prior revisions of posts?

    That’s not that hard to do. It all comes down to what you have installed on your site and what they need to save for each post.

    As an example, we’ve got one site where the wp_postmeta table is about 500MB and has over 4,700,000 rows. And… each one of those is needed.

    In our case, and also most likely in yours, there is nothing to fix. It’s data that’s savd by your stie for whatever reason your sites theme or plugins need.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘wp_postmeta is huge’ is closed to new replies.