Ekto gammit

Cleaning up WordPress database after UTW

After upgrading to WordPress 2.3 and trying to re-evaluate tag usage, I decided to re-visit an old pet-peeve of mine: The relatively massive (read: gi-normous) size of my wp_postmeta table. It was always the biggest table in my database (thanks to UTW), so whenever I was poking around in the database it caught my eye (it was over 5MB).

With WordPress 2.3 ‘tags’ are starting to be handled internally, and the need for UTW in it’s old form (rumor is it will be broken up into elements complementing WordPress’ new built-in tagging system) is no longer, so I got out the scissors and…

Taking a closer look, I had over 30,000 records in wp_postmeta that had a meta_key named _utw_tags_0. Amidst thoughts of how these records were somehow data-intercourse/sexing it up and reproducing like bunnies, I started warming up phpMyAdmin (does that behemoth take a while to start or what?).
wp_postmeta_table.jpg
Once phpMyAdmin was up, I selected my site’s database, then the wp_postmeta (the ‘wp_’ prefix is the default, if yours is different, adjust the SQL query appropriately) table from the list on the left side of the phpMyAdmin interface.

wp_postmeta SQL queryboxOnce you have the wp_postmeta table in front of you, click on the SQL tab at the top of the page and you should end up on a page with a large text box and a query already started for you. Highlight that text and replace it with:

DELETE FROM `wp_postmeta` WHERE meta_key = '_utw_tags_0'

You will get some sort of “Are you sure you want to destroy Planet Earth” notice, click yes.

I still had about 10 records with a meta_key title of _utw_tags_ so I used the same steps as above and blasted them with:

DELETE FROM `wp_postmeta` WHERE meta_key = '_utw_tags_'

This brought my wp_postmeta table down from over 5MB to less then 22kB. Can you say: Wheeee?

Tagged with: , , , , ,
Posted in Computers, Things, WordPress
4 comments on “Cleaning up WordPress database after UTW
  1. Free Self Improvement says:

    Well my WP upgrade went ok, had a few issues using an automatic upgrade plugin but in the end everything went fine.

    The only this that has bothered me is my formatting seems to have been alertered since the upgrade, with a few random spaces being added under headers, has anyone else experienced this?

  2. I have not yet upgraded, I am a bit scared! But if I can trim down my DB like this I might want to do it soon!

  3. Ludo says:

    That’s good! WordPress is very cool :)

  4. `rolandinsh` says:

    Thanks for idea :)
    In past I was using several plugins and after re-installs db was full of unnecessary records. Like this I just made my db more lighter … and blog faster :)

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>