{"id":19679,"date":"2011-06-23T23:12:50","date_gmt":"2011-06-23T17:42:50","guid":{"rendered":"https:\/\/www.quickonlinetips.com\/archives\/?p=19679"},"modified":"2026-10-13T13:39:52","modified_gmt":"2026-10-13T08:09:52","slug":"optimize-wordpress-database","status":"publish","type":"post","link":"https:\/\/www.quickonlinetips.com\/archives\/2011\/06\/optimize-wordpress-database\/","title":{"rendered":"How to Optimize WordPress Database Easily (and Safely) in 2026"},"content":{"rendered":"<p>Is your WordPress admin getting slow? Over the years your database fills with old revisions, spam comments, expired transients and leftover plugin data. When our own WordPress admin slowed down and our host started sending resource alerts, cleaning and optimising the database made a noticeable difference. Here is how to <strong>optimize WordPress database<\/strong> tables easily and safely in 2026.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-large wp-image-64096\" src=\"https:\/\/www.quickonlinetips.com\/archives\/wp-content\/uploads\/optimize-wordpress-database-1024x538.webp\" alt=\"Optimize WordPress database easily\" width=\"1024\" height=\"538\" srcset=\"https:\/\/www.quickonlinetips.com\/archives\/wp-content\/uploads\/optimize-wordpress-database-1024x538.webp 1024w, https:\/\/www.quickonlinetips.com\/archives\/wp-content\/uploads\/optimize-wordpress-database-300x158.webp 300w, https:\/\/www.quickonlinetips.com\/archives\/wp-content\/uploads\/optimize-wordpress-database-150x79.webp 150w, https:\/\/www.quickonlinetips.com\/archives\/wp-content\/uploads\/optimize-wordpress-database-768x403.webp 768w, https:\/\/www.quickonlinetips.com\/archives\/wp-content\/uploads\/optimize-wordpress-database.webp 1200w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/p>\n<p><strong>Quick answer:<\/strong> Back up your database first. Then use a plugin such as WP-Optimize, Advanced Database Cleaner or the Database tool in LiteSpeed Cache to remove post revisions, auto-drafts, trashed and spam comments and expired transients, and optimise tables. Advanced users can run <code>wp db optimize<\/code> with WP-CLI or use phpMyAdmin&#8217;s Optimize table. Then limit revisions so the clutter does not return.<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_89 counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-6aeba8957781e\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"ez-toc-cssicon\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #1a202c;color:#1a202c\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #1a202c;color:#1a202c\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6aeba8957781e\" checked aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.quickonlinetips.com\/archives\/2011\/06\/optimize-wordpress-database\/#Step_1_Back_up_first\" >Step 1: Back up first<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.quickonlinetips.com\/archives\/2011\/06\/optimize-wordpress-database\/#Step_2_Clean_and_optimise_with_a_plugin\" >Step 2: Clean and optimise with a plugin<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.quickonlinetips.com\/archives\/2011\/06\/optimize-wordpress-database\/#What_to_clean\" >What to clean<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.quickonlinetips.com\/archives\/2011\/06\/optimize-wordpress-database\/#Optimise_tables_manually\" >Optimise tables manually<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.quickonlinetips.com\/archives\/2011\/06\/optimize-wordpress-database\/#Prevent_clutter\" >Prevent clutter<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.quickonlinetips.com\/archives\/2011\/06\/optimize-wordpress-database\/#Does_it_make_WordPress_faster\" >Does it make WordPress faster?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.quickonlinetips.com\/archives\/2011\/06\/optimize-wordpress-database\/#FAQ\" >FAQ<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.quickonlinetips.com\/archives\/2011\/06\/optimize-wordpress-database\/#Is_it_safe_to_optimise_the_WordPress_database\" >Is it safe to optimise the WordPress database?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/www.quickonlinetips.com\/archives\/2011\/06\/optimize-wordpress-database\/#How_often_should_I_optimise\" >How often should I optimise?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/www.quickonlinetips.com\/archives\/2011\/06\/optimize-wordpress-database\/#What_is_%E2%80%9Coverhead%E2%80%9D_in_phpMyAdmin\" >What is &#8220;overhead&#8221; in phpMyAdmin?<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"Step_1_Back_up_first\"><\/span>Step 1: Back up first<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Always back up the full database before cleaning it. Use your host&#8217;s backup tool, a plugin like UpdraftPlus, or export from phpMyAdmin. Here is how to <a href=\"https:\/\/www.quickonlinetips.com\/archives\/2009\/10\/backup-restore-wordpress-database\/\">back up and restore a WordPress database<\/a>.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Step_2_Clean_and_optimise_with_a_plugin\"><\/span>Step 2: Clean and optimise with a plugin<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<ul>\n<li><strong><a href=\"https:\/\/wordpress.org\/plugins\/wp-optimize\/\" target=\"_blank\" rel=\"noopener\">WP-Optimize<\/a>:<\/strong> one-click cleanup of revisions, drafts, spam, trash and transients, plus table optimisation and scheduled cleanups.<\/li>\n<li><strong><a href=\"https:\/\/wordpress.org\/plugins\/advanced-database-cleaner\/\" target=\"_blank\" rel=\"noopener\">Advanced Database Cleaner<\/a>:<\/strong> also finds orphaned tables and options left behind by deleted plugins.<\/li>\n<li><strong>LiteSpeed Cache:<\/strong> if you already use it, its <strong>Database<\/strong> menu cleans revisions, transients and optimises tables without another plugin.<\/li>\n<\/ul>\n<h2><span class=\"ez-toc-section\" id=\"What_to_clean\"><\/span>What to clean<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<ul>\n<li><strong>Post revisions:<\/strong> often the biggest clutter on older blogs. See how to <a href=\"https:\/\/www.quickonlinetips.com\/archives\/2011\/06\/delete-post-revisions-in-wordpress\/\">delete post revisions<\/a>.<\/li>\n<li><strong>Auto-drafts and trashed posts<\/strong><\/li>\n<li><strong>Spam and trashed comments:<\/strong> or <a href=\"https:\/\/www.quickonlinetips.com\/archives\/2011\/04\/automatically-empty-wordpress-trash-daily\/\">empty the trash automatically<\/a>.<\/li>\n<li><strong>Expired transients:<\/strong> temporary cached data plugins forget to remove.<\/li>\n<li><strong>Large autoloaded options:<\/strong> data loaded on every page; tools like Query Monitor or Advanced Database Cleaner show the biggest ones.<\/li>\n<\/ul>\n<h2><span class=\"ez-toc-section\" id=\"Optimise_tables_manually\"><\/span>Optimise tables manually<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<ul>\n<li><strong>phpMyAdmin:<\/strong> select your database, tick all tables and choose <strong>Optimize table<\/strong>.<\/li>\n<li><strong>WP-CLI:<\/strong> run <code>wp db optimize<\/code>, and <code>wp transient delete --expired<\/code> to clear expired transients.<\/li>\n<\/ul>\n<p>On modern InnoDB tables, optimisation reclaims less space than in the old MyISAM days, so cleanup matters more than the optimise step.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Prevent_clutter\"><\/span>Prevent clutter<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Add these lines to wp-config.php:<\/p>\n<pre><code>define( 'WP_POST_REVISIONS', 5 );\ndefine( 'AUTOSAVE_INTERVAL', 120 );<\/code><\/pre>\n<p>Delete plugins you no longer use, and schedule a monthly cleanup in WP-Optimize or LiteSpeed Cache.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Does_it_make_WordPress_faster\"><\/span>Does it make WordPress faster?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>A lean database helps the admin area, search and uncached pages. For visitors, page caching matters more; see our <a href=\"https:\/\/www.quickonlinetips.com\/archives\/2012\/02\/increase-site-speed\/\">tips to increase site speed<\/a>.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"FAQ\"><\/span>FAQ<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><span class=\"ez-toc-section\" id=\"Is_it_safe_to_optimise_the_WordPress_database\"><\/span>Is it safe to optimise the WordPress database?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Yes, with a backup and a well-known plugin. Avoid deleting tables you do not recognise unless you are sure they belong to removed plugins.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"How_often_should_I_optimise\"><\/span>How often should I optimise?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Monthly for busy sites, every few months for small blogs.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"What_is_%E2%80%9Coverhead%E2%80%9D_in_phpMyAdmin\"><\/span>What is &#8220;overhead&#8221; in phpMyAdmin?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Unused space left after rows are deleted. Optimising a table reclaims it.<\/p>\n<p>How much did your database shrink? Share your results in the comments.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Is your WordPress admin getting slow? Over the years your database fills with old revisions, spam comments, expired transients and&#8230;<\/p>\n","protected":false},"author":4,"featured_media":64096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","footnotes":""},"categories":[6],"tags":[49,17],"class_list":["post-19679","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blogging","tag-tutorials","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/posts\/19679","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/comments?post=19679"}],"version-history":[{"count":3,"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/posts\/19679\/revisions"}],"predecessor-version":[{"id":65407,"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/posts\/19679\/revisions\/65407"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/media\/64096"}],"wp:attachment":[{"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/media?parent=19679"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/categories?post=19679"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/tags?post=19679"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}