{"id":142618,"date":"2015-06-25T11:00:48","date_gmt":"2015-06-25T15:00:48","guid":{"rendered":"http:\/\/premium.wpmudev.org\/blog\/?p=142618"},"modified":"2016-12-13T21:32:07","modified_gmt":"2016-12-13T21:32:07","slug":"squeaky-clean-database","status":"publish","type":"post","link":"https:\/\/wpmudev.com\/blog\/squeaky-clean-database\/","title":{"rendered":"10 Tips for Keeping a Squeaky Clean WordPress (and Multisite!) Database"},"content":{"rendered":"<p class=\"p1\"><span class=\"s1\">If you\u2019ve been using WordPress for a while, chances are your site is due for a clean up.<\/span><\/p>\n<p class=\"p2\"><span class=\"s1\">Your database may be full of unnecessary tables that, inevitably, make your site sluggish and bloated.<\/span><\/p>\n<p class=\"p2\"><span class=\"s1\">Doing regular cleanups allow you to reduce the size of your database, which means you backup files will be quicker and smaller.<\/span><\/p>\n<p class=\"p2\"><span class=\"s1\">In today\u2019s post, we\u2019ll look at several ways you can keep your database squeaky clean with simple SQL queries, as well as plugins. We\u2019ll also look at tips for single and Multisite installations.<\/span><\/p>\n<p class=\"p2\"><span class=\"s1\">So grab your mop and bucket and let\u2019s get started.<\/span><\/p>\n<h3>Basic Housekeeping<\/h3>\n<p>Before you get stuck into spring cleaning, it&#8217;s important to ensure you backup both your database and your site&#8217;s files.<\/p>\n<p>Sometimes things can go wrong seemingly out of the blue. Keeping an extra copy of your site handy can help you restore everything in a flash in case things get messy.<\/p>\n<p>If you&#8217;re not sure how to create a backup of your entire site, check out out posts:\u00a0<a href=\"https:\/\/wpmudev.com\/blog\/backup-with-snapshot\/\" target=\"_blank\">How to Backup Your WordPress Website (and Multisite) Using Snapshot<\/a> and\u00a0<a href=\"https:\/\/wpmudev.com\/blog\/backup-and-restoring\/\" target=\"_blank\">Backup Plugins Aren\u2019t about Backing up, They\u2019re about Restoring<\/a>.<\/p>\n<h3>Deleting Unused Plugins<\/h3>\n<p>One of the easiest and often most effective ways to reduce the clutter in your database is to delete any plugins you aren&#8217;t using.<\/p>\n<p>I have a secret shame: I like to test out plugins, but too often forget to delete them after I&#8217;m done. Oops!<\/p>\n<figure class=\"wp-caption aligncenter\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"attachment-735x735\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2015\/06\/inactive-plugins.png\" alt=\"The inactive plugins link is highlighted in the admin dashboard &gt; Plugins &gt; Installed Plugins page.\" width=\"735\" height=\"290\" \/><figcaption class=\"wp-caption-text\">If you have a lot of inactive plugins listed on your plugins page, like me, you should consider deleting them.<\/figcaption><\/figure>\n<p>I surely can&#8217;t be the only one who does this, can I? Perhaps you or one of your clients is guilty of this, too? Or else you install a plugin forgetting you already have a similar one installed. No matter what the case, it&#8217;s a good idea to look through your plugins list every now and again and determine which ones should stay and which ones can be tossed away.<\/p>\n<p>Plugins often take up a lot of space in your database so eliminating any unnecessary ones is a great preliminary step toward cleaning house\u00a0\u2013 or rather, database.<\/p>\n<h3>How to Enter SQL Commands in Your Database<\/h3>\n<p>You guessed it; you&#8217;ll need to access your database for a lot of these cleanup options. If you can&#8217;t remember your username and password that&#8217;s okay because they&#8217;re stored in your <em>wp-config.php<\/em> file.<\/p>\n<p>The code you&#8217;re looking for should be similar to this:<\/p>\n<div class=\"gist\" data-gist=\"813f8e7f65492bf70c0c251862a8c6eb\" data-gist-file=\"wp-config.php\"><a class=\"loading\" href=\"https:\/\/gist.github.com\/813f8e7f65492bf70c0c251862a8c6eb.js?file=wp-config.php\">Loading gist 813f8e7f65492bf70c0c251862a8c6eb<\/a><div class=\"gist-consent-notice\" style=\"display:none\"><p>Please <a href=\"javascript:Cookiebot.renew()\">update your cookie preferences<\/a> to enable preference cookies to view this gist.<\/p><\/div><\/div>\n<p>In this example, <code>yourusername<\/code>\u00a0would be replaced with your actual database&#8217;s username, and <code>this-is-your-password<\/code> will be replaced by your real password.<\/p>\n<p>Once you&#8217;re in the phpMyAdmin control panel, click on the database you would like to clean up, then click on the <strong>SQL<\/strong> tab.<\/p>\n<figure class=\"wp-caption aligncenter\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"attachment-735x735\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2015\/06\/sql-query-phpMyAdmin.png\" alt=\"The SQL tab has been clicked in phpMyAdmin.\" width=\"735\" height=\"410\" \/><figcaption class=\"wp-caption-text\">If you&#8217;re feeling adventurous, you can also create your own queries by clicking on the <strong>Query<\/strong> tab and filling out the applicable fields.<\/figcaption><\/figure>\n<p>On this page, you can enter the queries you would like from below then click the <strong>Go<\/strong> button to run them.<\/p>\n<p>If you end up seeing a message saying zero tables were affected, then congratulations\u00a0\u2013 your tables were already in great condition for this particular task!<\/p>\n<p>Now that you&#8217;re all set up let&#8217;s run some queries.<\/p>\n<h3>Delete Lingering Plugin and Post Data<\/h3>\n<p>After deleting all the plugins you aren&#8217;t using, it&#8217;s a great idea to purge your database from all the data that&#8217;s left over from those plugins. This is also where data from your posts is stored.<\/p>\n<p>It&#8217;s all in the <code>wp_postmeta<\/code> table and running this query can help you get rid of all that unwanted clutter. Just remember to replace <code>your-meta-key<\/code> with the value you need to clear out.<\/p>\n<div class=\"gist\" data-gist=\"1c44e4b69266cf7cd38eef5e1cb8ed2d\" data-gist-file=\"post-meta.sql\"><a class=\"loading\" href=\"https:\/\/gist.github.com\/1c44e4b69266cf7cd38eef5e1cb8ed2d.js?file=post-meta.sql\">Loading gist 1c44e4b69266cf7cd38eef5e1cb8ed2d<\/a><div class=\"gist-consent-notice\" style=\"display:none\"><p>Please <a href=\"javascript:Cookiebot.renew()\">update your cookie preferences<\/a> to enable preference cookies to view this gist.<\/p><\/div><\/div>\n<p>If you&#8217;re using a Multisite installation, try this one instead:<\/p>\n<div class=\"gist\" data-gist=\"98acb9bdff42924ddd948e3f65928199\" data-gist-file=\"postMetaMS.sql\"><a class=\"loading\" href=\"https:\/\/gist.github.com\/98acb9bdff42924ddd948e3f65928199.js?file=postMetaMS.sql\">Loading gist 98acb9bdff42924ddd948e3f65928199<\/a><div class=\"gist-consent-notice\" style=\"display:none\"><p>Please <a href=\"javascript:Cookiebot.renew()\">update your cookie preferences<\/a> to enable preference cookies to view this gist.<\/p><\/div><\/div>\n<p>In this query, you need to replace <code>#<\/code> with the ID of the site you wish to clean up and, again, <code>your-meta-key<\/code> should be changed to the value you need to delete.<\/p>\n<h3>Delete All Spam Comments<\/h3>\n<p>Comment spam has been around for what feels like ages and doesn&#8217;t seem to be letting up any time soon. If you&#8217;re finding an overwhelming amount of spam on your site, this query should clear out all of it.<\/p>\n<div class=\"gist\" data-gist=\"30181fe05f9b45f7a2e73e6b750e8b3c\" data-gist-file=\"spamComments.sql\"><a class=\"loading\" href=\"https:\/\/gist.github.com\/30181fe05f9b45f7a2e73e6b750e8b3c.js?file=spamComments.sql\">Loading gist 30181fe05f9b45f7a2e73e6b750e8b3c<\/a><div class=\"gist-consent-notice\" style=\"display:none\"><p>Please <a href=\"javascript:Cookiebot.renew()\">update your cookie preferences<\/a> to enable preference cookies to view this gist.<\/p><\/div><\/div>\n<p>For Multisite, here&#8217;s the code you would like to use as well for all your other sites:<\/p>\n<div class=\"gist\" data-gist=\"cdab08adb2ae95dbf8be1e0f33752414\" data-gist-file=\"spamCommentsMS.sql\"><a class=\"loading\" href=\"https:\/\/gist.github.com\/cdab08adb2ae95dbf8be1e0f33752414.js?file=spamCommentsMS.sql\">Loading gist cdab08adb2ae95dbf8be1e0f33752414<\/a><div class=\"gist-consent-notice\" style=\"display:none\"><p>Please <a href=\"javascript:Cookiebot.renew()\">update your cookie preferences<\/a> to enable preference cookies to view this gist.<\/p><\/div><\/div>\n<p>Just replace <code>#<\/code> to the site ID you would like to purge of spam comments.<\/p>\n<h3>Clear Out All Comments Awaiting Moderation<\/h3>\n<p>If you have a lot of spam comments that you haven&#8217;t\u00a0yet moderated, this query can help you clear it all out. Just be sure to look through the list and approve any genuine comments before going ahead with this query since all the comments awaiting moderation will be erased.<\/p>\n<div class=\"gist\" data-gist=\"5450cc8ec305c761c56e5b0d81168e43\" data-gist-file=\"commentsModeration.sql\"><a class=\"loading\" href=\"https:\/\/gist.github.com\/5450cc8ec305c761c56e5b0d81168e43.js?file=commentsModeration.sql\">Loading gist 5450cc8ec305c761c56e5b0d81168e43<\/a><div class=\"gist-consent-notice\" style=\"display:none\"><p>Please <a href=\"javascript:Cookiebot.renew()\">update your cookie preferences<\/a> to enable preference cookies to view this gist.<\/p><\/div><\/div>\n<p>For Multisite installs, also try this code:<\/p>\n<div class=\"gist\" data-gist=\"9481cf38f4078213ccb1ffbad7ca0bfa\" data-gist-file=\"commentsModerationMS.sql\"><a class=\"loading\" href=\"https:\/\/gist.github.com\/9481cf38f4078213ccb1ffbad7ca0bfa.js?file=commentsModerationMS.sql\">Loading gist 9481cf38f4078213ccb1ffbad7ca0bfa<\/a><div class=\"gist-consent-notice\" style=\"display:none\"><p>Please <a href=\"javascript:Cookiebot.renew()\">update your cookie preferences<\/a> to enable preference cookies to view this gist.<\/p><\/div><\/div>\n<p>Just like the others, replace <code>#<\/code> with the applicable site ID.<\/p>\n<h3>Begone, Unused Tags!<\/h3>\n<p>If you&#8217;re like me, you have so many tags that are left unused because you change your mind and edit your tags a few times per post. It can be helpful to clear them out and start fresh. This query will delete all tags that aren&#8217;t associated with any posts.<\/p>\n<div class=\"gist\" data-gist=\"0638959560b159bcdae4ad7f616b44ed\" data-gist-file=\"unusedTags.sql\"><a class=\"loading\" href=\"https:\/\/gist.github.com\/0638959560b159bcdae4ad7f616b44ed.js?file=unusedTags.sql\">Loading gist 0638959560b159bcdae4ad7f616b44ed<\/a><div class=\"gist-consent-notice\" style=\"display:none\"><p>Please <a href=\"javascript:Cookiebot.renew()\">update your cookie preferences<\/a> to enable preference cookies to view this gist.<\/p><\/div><\/div>\n<p>For all your sites in your network, just replace <code>#<\/code> in the code below with the site ID:<\/p>\n<div class=\"gist\" data-gist=\"eeef2cda78847f6718712eae882f0043\" data-gist-file=\"unusedTagsMS.sql\"><a class=\"loading\" href=\"https:\/\/gist.github.com\/eeef2cda78847f6718712eae882f0043.js?file=unusedTagsMS.sql\">Loading gist eeef2cda78847f6718712eae882f0043<\/a><div class=\"gist-consent-notice\" style=\"display:none\"><p>Please <a href=\"javascript:Cookiebot.renew()\">update your cookie preferences<\/a> to enable preference cookies to view this gist.<\/p><\/div><\/div>\n<h3>Pingbacks, I Bid Thee Farewell<\/h3>\n<p>If you have turned off the option for accepting pingbacks and you would like to remove every single one from your database, this may very well be the query for you.<\/p>\n<div class=\"gist\" data-gist=\"a77befd345c153af1860da0301ff913d\" data-gist-file=\"deletePingbacks.sql\"><a class=\"loading\" href=\"https:\/\/gist.github.com\/a77befd345c153af1860da0301ff913d.js?file=deletePingbacks.sql\">Loading gist a77befd345c153af1860da0301ff913d<\/a><div class=\"gist-consent-notice\" style=\"display:none\"><p>Please <a href=\"javascript:Cookiebot.renew()\">update your cookie preferences<\/a> to enable preference cookies to view this gist.<\/p><\/div><\/div>\n<p>If you&#8217;re running Multisite and want to delete pingbacks on other sites other than your main one, use the following code.<\/p>\n<div class=\"gist\" data-gist=\"8bcf4e21f74bc230501d09a138f82bc0\" data-gist-file=\"deletePingbacksMS.sql\"><a class=\"loading\" href=\"https:\/\/gist.github.com\/8bcf4e21f74bc230501d09a138f82bc0.js?file=deletePingbacksMS.sql\">Loading gist 8bcf4e21f74bc230501d09a138f82bc0<\/a><div class=\"gist-consent-notice\" style=\"display:none\"><p>Please <a href=\"javascript:Cookiebot.renew()\">update your cookie preferences<\/a> to enable preference cookies to view this gist.<\/p><\/div><\/div>\n<p>Don&#8217;t forget: Be sure to change <code>#<\/code> to the site ID you would like to scrub clean.<\/p>\n<h3>Getting Rid of All Your Trackbacks<\/h3>\n<p>While we&#8217;re clearing out pingbacks, why not trackbacks as well? This query will help you do just that. It&#8217;s probably best to make sure you have disabled pingbacks and trackbacks before trying this one.<\/p>\n<div class=\"gist\" data-gist=\"fbbdce5f8fc277583a13026ef0b8f523\" data-gist-file=\"deleteTrackbacks.sql\"><a class=\"loading\" href=\"https:\/\/gist.github.com\/fbbdce5f8fc277583a13026ef0b8f523.js?file=deleteTrackbacks.sql\">Loading gist fbbdce5f8fc277583a13026ef0b8f523<\/a><div class=\"gist-consent-notice\" style=\"display:none\"><p>Please <a href=\"javascript:Cookiebot.renew()\">update your cookie preferences<\/a> to enable preference cookies to view this gist.<\/p><\/div><\/div>\n<p>For Multisite, just replace # with the appropriate site ID. Here&#8217;s the code you need:<\/p>\n<div class=\"gist\" data-gist=\"33719f263d9edff21ee42284caae5fcf\" data-gist-file=\"deleteTrackbacksMS.sql\"><a class=\"loading\" href=\"https:\/\/gist.github.com\/33719f263d9edff21ee42284caae5fcf.js?file=deleteTrackbacksMS.sql\">Loading gist 33719f263d9edff21ee42284caae5fcf<\/a><div class=\"gist-consent-notice\" style=\"display:none\"><p>Please <a href=\"javascript:Cookiebot.renew()\">update your cookie preferences<\/a> to enable preference cookies to view this gist.<\/p><\/div><\/div>\n<h3>Say <em>Sayonara<\/em> to Post Revisions<\/h3>\n<p>For older sites with tons of posts and pages, the revisions can really stack up quickly in your database. To clear them <em>all<\/em> out, run this query.<\/p>\n<p>Thanks to programmer\u00a0Joseph Michael Ambrosio, this code ensures all revisions are removed without unintended data loss.<\/p>\n<div class=\"gist\" data-gist=\"b6c0e935a4d8f64a68e0dc23ca797208\" data-gist-file=\"revisions.sql\"><a class=\"loading\" href=\"https:\/\/gist.github.com\/b6c0e935a4d8f64a68e0dc23ca797208.js?file=revisions.sql\">Loading gist b6c0e935a4d8f64a68e0dc23ca797208<\/a><div class=\"gist-consent-notice\" style=\"display:none\"><p>Please <a href=\"javascript:Cookiebot.renew()\">update your cookie preferences<\/a> to enable preference cookies to view this gist.<\/p><\/div><\/div>\n<p>For your network, this code can be adapted to use on other sites besides your main one:<\/p>\n<div class=\"gist\" data-gist=\"f4c7dbcee6a2f77ce88c35bc13f8d440\" data-gist-file=\"revisionsMS.sql\"><a class=\"loading\" href=\"https:\/\/gist.github.com\/f4c7dbcee6a2f77ce88c35bc13f8d440.js?file=revisionsMS.sql\">Loading gist f4c7dbcee6a2f77ce88c35bc13f8d440<\/a><div class=\"gist-consent-notice\" style=\"display:none\"><p>Please <a href=\"javascript:Cookiebot.renew()\">update your cookie preferences<\/a> to enable preference cookies to view this gist.<\/p><\/div><\/div>\n<p>Just be sure to replace <code>#<\/code> with the relevant site ID and you&#8217;re all set to use this along with the original for your main site.<\/p>\n<h3>Dumping All Your Shortcodes When You Fall Out of Love<\/h3>\n<p>If you&#8217;re like me and have installed and tested out many plugins without deleting them after, you may have a lot of stray shortcodes that don&#8217;t actually do anything anymore. Maybe you even stopped using a theme that included shortcodes. After deactivating it, you&#8217;re left with a mess of unusable shortcodes. Here&#8217;s a quick way to clear all instances of your shortcode with an SQL query.<\/p>\n<div class=\"gist\" data-gist=\"e521910da1427155de7a1612e41b9178\" data-gist-file=\"deleteShortcode.sql\"><a class=\"loading\" href=\"https:\/\/gist.github.com\/e521910da1427155de7a1612e41b9178.js?file=deleteShortcode.sql\">Loading gist e521910da1427155de7a1612e41b9178<\/a><div class=\"gist-consent-notice\" style=\"display:none\"><p>Please <a href=\"javascript:Cookiebot.renew()\">update your cookie preferences<\/a> to enable preference cookies to view this gist.<\/p><\/div><\/div>\n<p>For Multisite networks, here&#8217;s the code you can use for your other sites. Just change <code>#<\/code> to your site ID for things to run smoothly.<\/p>\n<div class=\"gist\" data-gist=\"d366b130ff892a6b97191e6233cda4ba\" data-gist-file=\"shortcode.sql\"><a class=\"loading\" href=\"https:\/\/gist.github.com\/d366b130ff892a6b97191e6233cda4ba.js?file=shortcode.sql\">Loading gist d366b130ff892a6b97191e6233cda4ba<\/a><div class=\"gist-consent-notice\" style=\"display:none\"><p>Please <a href=\"javascript:Cookiebot.renew()\">update your cookie preferences<\/a> to enable preference cookies to view this gist.<\/p><\/div><\/div>\n<h3>Scrap All Your Old Posts<\/h3>\n<p>If your site has been around for more years than you care to count, you may have a lot of outdated posts that you would feel more comfortable with if they were just removed altogether. That&#8217;s not a problem with this query where you can do just that.<\/p>\n<p>Simply replace <code>#-of-days<\/code> for the amount of time in days where you want posts to start being deleted. For example, if you would like to delete all posts that are older than time\u00a0\u2013 I mean, five years\u00a0\u2013 you would enter 1825.<\/p>\n<div class=\"gist\" data-gist=\"c6f203460a675243eadb6824ade775aa\" data-gist-file=\"oldPosts.sql\"><a class=\"loading\" href=\"https:\/\/gist.github.com\/c6f203460a675243eadb6824ade775aa.js?file=oldPosts.sql\">Loading gist c6f203460a675243eadb6824ade775aa<\/a><div class=\"gist-consent-notice\" style=\"display:none\"><p>Please <a href=\"javascript:Cookiebot.renew()\">update your cookie preferences<\/a> to enable preference cookies to view this gist.<\/p><\/div><\/div>\n<p>For Multisite, here&#8217;s the code you would need for other sites in your network:<\/p>\n<div class=\"gist\" data-gist=\"1c5f94e4e44a6059d8aaf7bb71d4c908\" data-gist-file=\"oldPostsMS.sql\"><a class=\"loading\" href=\"https:\/\/gist.github.com\/1c5f94e4e44a6059d8aaf7bb71d4c908.js?file=oldPostsMS.sql\">Loading gist 1c5f94e4e44a6059d8aaf7bb71d4c908<\/a><div class=\"gist-consent-notice\" style=\"display:none\"><p>Please <a href=\"javascript:Cookiebot.renew()\">update your cookie preferences<\/a> to enable preference cookies to view this gist.<\/p><\/div><\/div>\n<p>In addition to changing <code>#-of-days<\/code> just as the previous code example, you would also need to change <code>#<\/code> to the ID of the site you would like to clean up.<\/p>\n<h3>Got Junk? Deleting All Scrap Comments<\/h3>\n<p>Sometimes, your <code>wp_commentsmeta<\/code> table becomes full of irrelevant approved comments that aren&#8217;t stored in your <code>wp_comments<\/code> table. This may not be a query that&#8217;s suitable for everyone, but sometimes this can really be a problem, especially if you deleted a plugin that used the <code>wp_commentsmeta<\/code> table.<\/p>\n<div class=\"gist\" data-gist=\"b9cae59327f252dff9477a5fa227cf01\" data-gist-file=\"commentmeta.sql\"><a class=\"loading\" href=\"https:\/\/gist.github.com\/b9cae59327f252dff9477a5fa227cf01.js?file=commentmeta.sql\">Loading gist b9cae59327f252dff9477a5fa227cf01<\/a><div class=\"gist-consent-notice\" style=\"display:none\"><p>Please <a href=\"javascript:Cookiebot.renew()\">update your cookie preferences<\/a> to enable preference cookies to view this gist.<\/p><\/div><\/div>\n<p>If you would also like to clear out the <code>wp_commentsmeta<\/code> table for other sites in your network, use this code as well:<\/p>\n<div class=\"gist\" data-gist=\"a257633d9f95d7399c305cd2252b7358\" data-gist-file=\"commentmetaMS.sql\"><a class=\"loading\" href=\"https:\/\/gist.github.com\/a257633d9f95d7399c305cd2252b7358.js?file=commentmetaMS.sql\">Loading gist a257633d9f95d7399c305cd2252b7358<\/a><div class=\"gist-consent-notice\" style=\"display:none\"><p>Please <a href=\"javascript:Cookiebot.renew()\">update your cookie preferences<\/a> to enable preference cookies to view this gist.<\/p><\/div><\/div>\n<p>Just don&#8217;t forget to replace <code>#<\/code> with the appropriate site ID.<\/p>\n<h3>Optimize Your Tables<\/h3>\n<p>In just a few clicks, you can also optimize your tables without the use of plugins.<\/p>\n<figure class=\"wp-caption aligncenter\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"attachment-490x490\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2015\/06\/optimize-table.png\" alt=\"The optimize table query from the select box in phpMyAdmin.\" width=\"490\" height=\"210\" \/><figcaption class=\"wp-caption-text\">You don&#8217;t necessarily need to check all of the tables, just the ones that are large that you can see under the <strong>Size<\/strong> column.<\/figcaption><\/figure>\n<p>In phpMyAdmin, click on your database and scroll down to the bottom of the page that loads to the right. Click the <strong>Check All<\/strong> checkbox at the bottom and then select <strong>Optimize table<\/strong> from the drop down list beside it. If you have multiple pages of tables, you&#8217;ll need to repeat this step for them.<\/p>\n<p>You don&#8217;t need to press the Go button as things will start moving automatically. It may take a while particularly if your site is large so don&#8217;t panic if this is the case for you.<\/p>\n<p>You should see a success message eventually.<\/p>\n<figure class=\"wp-caption aligncenter\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"attachment-490x490\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2015\/06\/optimize-table-successful.png\" alt=\"The success message of the optimize tables query.\" width=\"490\" height=\"210\" \/><figcaption class=\"wp-caption-text\">You may see messages on the page that loads with a &#8220;success&#8221; message that notes that your tables don&#8217;t support optimize and a recreate has been executed. This is usually fine.<\/figcaption><\/figure>\n<p>Now that we have covered all the DIY spring cleaning tips, let&#8217;s take a look at some fabulous plugins to help you make cleaning your databases even easier.<\/p>\n<h3>Database Optimizing Plugins<\/h3>\n<p>These plugins are updated regularly and compatible with single installations of WordPress, although, I have tested them out on Multisite and they worked great. These plugins are fantastic, they make optimizing your database easy and they&#8217;re also very popular\u00a0for good reasons.<\/p>\n<ul class=\"dev-tutorial-list\"><li class=\"dev-tutorial-list__item\"><header class=\"dev-tutorial-list__item__header\"><h3 class=\"dev-tutorial-list__item__title\">WP-Optimize<\/h3><\/header><section class=\"dev-tutorial-list__item__image\"><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"171\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2015\/06\/wp-optimize-600x171.png\" class=\"attachment-ratio-large size-ratio-large\" alt=\"WP-Optimize image\" aria-hidden=\"true\" \/><\/section><!-- end dev-tutorial-list__item__image --><section class=\"dev-tutorial-list__item__content\"><p>This plugin has been around for a long time and it has remained one of the best plugins to help you optimize your WordPress site for free.<\/p>\n<p>It includes extensive and advanced options for removing unnecessary tables and can even schedule optimizations regularly to help keep your site in tip-top shape. It&#8217;s also a breeze to install and set up.<\/p>\n<\/section><!-- end dev-tutorial-list__item__content --><footer class=\"dev-tutorial-list__item__footer\"><p>Interested in WP-Optimize?<\/p><div class=\"dev-tutorial-list__item__cta\"><a target=\"_blank\" href=\"https:\/\/wordpress.org\/plugins\/wp-optimize\/\" class=\"dui-btn dui-btn--sm dui-btn--brand dev-btn--Download\">Download<\/a><\/div><!-- end dev-tutorial-list__item__cta --><\/footer><!-- end dev-tutorial-list__item__footer --><\/li><!-- end dev-tutorial-list__item --><li class=\"dev-tutorial-list__item\"><header class=\"dev-tutorial-list__item__header\"><h3 class=\"dev-tutorial-list__item__title\">Revision Control<\/h3><\/header><section class=\"dev-tutorial-list__item__image\"><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"171\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2015\/06\/Revision-Control-plugin-600x171.png\" class=\"attachment-ratio-large size-ratio-large\" alt=\"Revision Control image\" aria-hidden=\"true\" \/><\/section><!-- end dev-tutorial-list__item__image --><section class=\"dev-tutorial-list__item__content\"><p>I really like this plugin because you can limit the number of revisions that are stored in your database rather than deleting them all such as when you use the SQL query in this post. It&#8217;s also easy to install and use.<\/p>\n<\/section><!-- end dev-tutorial-list__item__content --><footer class=\"dev-tutorial-list__item__footer\"><p>Interested in Revision Control?<\/p><div class=\"dev-tutorial-list__item__cta\"><a target=\"_blank\" href=\"https:\/\/wordpress.org\/plugins\/revision-control\/\" class=\"dui-btn dui-btn--sm dui-btn--brand dev-btn--Download\">Download<\/a><\/div><!-- end dev-tutorial-list__item__cta --><\/footer><!-- end dev-tutorial-list__item__footer --><\/li><!-- end dev-tutorial-list__item --><\/ul><!-- end dev-tutorial-list -->\n<h3>Conclusion<\/h3>\n<p>That&#8217;s it, you&#8217;re all set to clean out your database and even for your entire network.\u00a0If you would like a list of even more plugins to help you replicate the SQL queries that were covered, check out our post\u00a0<a href=\"https:\/\/wpmudev.com\/blog\/clean-up-optimize-wordpress\/\" target=\"_blank\">10 Quick Ways to Clean Up and Optimize Your WordPress Site<\/a>.<\/p>\n<p>If you would like more information on how you can improve the overall performance of your site, take a look at some of our other posts:\u00a0<a href=\"https:\/\/wpmudev.com\/blog\/how-wordpress-becomes-unusable\/\" target=\"_blank\">How a WordPress Site Becomes Unusable and How to Prevent It<\/a>,\u00a0<a href=\"https:\/\/wpmudev.com\/blog\/top-cdn-services-to-make-your-wordpress-site-blazingly-fast\/\" target=\"_blank\">Top CDN Services to Make Your WordPress Site Blazingly Fast (and More Reliable)<\/a> and\u00a0<a href=\"https:\/\/wpmudev.com\/blog\/top-wordpress-caching-plugins\/\" target=\"_blank\">The Top 3 WordPress Caching Plugins Compared and Choosing the Best One for Your Site<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you\u2019ve been using WordPress for a while, chances are your site is overdue for a clean up. Your database may be full of unnecessary tables that, inevitably, make your site sluggish and bloated. Here are our top tips for spring cleaning your database.<\/p>\n","protected":false},"author":54213,"featured_media":142788,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"blog_reading_time":"","wds_primary_category":0,"wds_primary_tutorials_categories":0,"footnotes":""},"categories":[557,1117],"tags":[1004,10203,9798],"tutorials_categories":[],"class_list":["post-142618","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-development","category-multisite","tag-database","tag-optimization","tag-weekend-wordpress-projects"],"_links":{"self":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/142618","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/users\/54213"}],"replies":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/comments?post=142618"}],"version-history":[{"count":23,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/142618\/revisions"}],"predecessor-version":[{"id":222577,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/142618\/revisions\/222577"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/media\/142788"}],"wp:attachment":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/media?parent=142618"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/categories?post=142618"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/tags?post=142618"},{"taxonomy":"tutorials_categories","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/tutorials_categories?post=142618"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}