{"id":63658,"date":"2022-09-13T16:42:57","date_gmt":"2022-09-13T16:42:57","guid":{"rendered":"\/tutorials\/?p=63658"},"modified":"2024-09-02T09:53:42","modified_gmt":"2024-09-02T09:53:42","slug":"your-complete-guide-to-wordpress-database-optimization","status":"publish","type":"post","link":"\/my\/tutorials\/wordpress-database-optimization","title":{"rendered":"Your Complete Guide to WordPress Database Optimization"},"content":{"rendered":"<p>Your WordPress database stores all of your site&rsquo;s information. If it&rsquo;s become bloated with extra data, that can slow down your pages. Yet, at first glance, its numerous columns and settings can seem intimidating. Perhaps you&rsquo;re afraid that your efforts at WordPress database optimization might cause irreparable data loss.<\/p><p>However, optimizing a WordPress database isn&rsquo;t as complicated as it might initially appear, as many third-party plugins can help you with the process. After cleaning up a WordPress database and clearing up valuable server space, your site will be able to reach its highest performance potential.<\/p><p>In this article, we&rsquo;ll learn what a WordPress database is and discuss why ensuring its organization is critical. Afterward, we&rsquo;ll walk you through three ways how to optimize a database of your own. Let&rsquo;s get to it!<\/p><p class=\"has-text-align-center\"><a href=\"https:\/\/assets.hostinger.com\/content\/tutorials\/pdf\/Mega-WordPress-Cheat-EN.pdf\" target=\"_blank\" rel=\"noopener\">Download all in one WordPress cheat sheet<\/a><\/p><p>\n\n\n\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-understanding-wordpress-database\">Understanding WordPress Database<\/h2><p>The <a href=\"\/my\/tutorials\/wordpress-database\" target=\"_blank\" rel=\"noreferrer noopener\">WordPress database<\/a> is where all your website&rsquo;s data is stored. This information includes everything from usernames and passwords to comments and settings.&nbsp;<\/p><p>In order to store all of this essential data, WordPress uses <a href=\"https:\/\/www.mysql.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">MySQL<\/a>, an open-source database management system.<\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><a href=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/09\/MySQL-open-source-database-front-page.jpg\"><img decoding=\"async\" width=\"1024\" height=\"700\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/09\/MySQL-open-source-database-front-page-1024x700.jpg\" alt=\"MySQL open-source database front page\" class=\"wp-image-63665\" style=\"width:840px;height:574px\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2022\/09\/MySQL-open-source-database-front-page.jpg 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2022\/09\/MySQL-open-source-database-front-page-300x205.jpg 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2022\/09\/MySQL-open-source-database-front-page-150x103.jpg 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2022\/09\/MySQL-open-source-database-front-page-768x525.jpg 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div><p>To put it simply, WordPress establishes a database whenever you create a new website. The platform then stores this database on the web host&rsquo;s server.&nbsp;<\/p><p>After that, when a user visits your website, their web browser will make a <strong>request<\/strong> to that server. In other words, it asks the server to transmit the necessary data required to display and run your content.<\/p><p>Your database will expand with every new piece of information added to the website. WordPress will send a MySQL query to the database regarding what data needs to be altered, created, or removed. You can also carry out these commands manually or via a database manager.<\/p><h3 class=\"wp-block-heading\" id=\"h-what-are-wordpress-tables\">What Are WordPress Tables?<\/h3><p>The data contained in a WordPress database exists across eleven core tables, but it&rsquo;s possible to add more. Each one of these tables stores a specific type of data.<\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/09\/An-example-of-WordPress-tables-as-found-in-a-WordPress-database.jpg\"><img decoding=\"async\" width=\"1024\" height=\"673\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/09\/An-example-of-WordPress-tables-as-found-in-a-WordPress-database-1024x673.jpg\" alt=\"An example of WordPress tables as found in a WordPress database\" class=\"wp-image-63666\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2022\/09\/An-example-of-WordPress-tables-as-found-in-a-WordPress-database.jpg 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2022\/09\/An-example-of-WordPress-tables-as-found-in-a-WordPress-database-300x197.jpg 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2022\/09\/An-example-of-WordPress-tables-as-found-in-a-WordPress-database-150x99.jpg 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2022\/09\/An-example-of-WordPress-tables-as-found-in-a-WordPress-database-768x504.jpg 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div><p>For example, the <strong>wp_posts<\/strong> table only contains the data for your blog posts.<\/p><p>As of WordPress 4.4, the default tables are as follows:<\/p><ul class=\"wp-block-list\">\n<li><strong>wp_commentmeta<\/strong> &ndash; metadata information for comments.<\/li>\n\n\n\n<li><strong>wp_comments<\/strong> &ndash; comments text.<\/li>\n\n\n\n<li><strong>wp_links<\/strong> &ndash; information related to the <strong>Links<\/strong> feature.<\/li>\n\n\n\n<li><strong>wp_options<\/strong> &ndash; WordPress references and configuration settings.<\/li>\n\n\n\n<li><strong>wp_postmeta &ndash; <\/strong>metadata information for posts.<\/li>\n\n\n\n<li><strong>wp_posts &ndash; <\/strong>posts, pages, and navigation menu items.<\/li>\n\n\n\n<li><strong>wp_termmeta<\/strong> &ndash; metadata information for terms.<\/li>\n\n\n\n<li><strong>wp_terms &ndash; <\/strong>categories and tags.<\/li>\n\n\n\n<li><strong>wp_term relationships<\/strong> &ndash; relation between posts and their wp_terms.<\/li>\n\n\n\n<li><strong>wp_term taxonomy &ndash; <\/strong>taxonomy for the entries in the wp_terms table.<\/li>\n\n\n\n<li><strong>wp_usermeta &ndash; <\/strong>metadata information for users.<\/li>\n\n\n\n<li><strong>wp_users &ndash; <\/strong>list of users.<\/li>\n<\/ul><p>To access the WordPress database, you&rsquo;ll need to follow the method provided by your host. This can vary depending on which company you bought services from. However, in most cases, you&rsquo;ll access the database via a free and open-source administration tool called <a href=\"https:\/\/www.phpmyadmin.net\/\" target=\"_blank\" rel=\"noreferrer noopener\">phpMyAdmin<\/a>.&nbsp;<\/p><p>WordPress database is primarily self-sufficient. You don&rsquo;t need to interact with it in order to publish or manage a website. However, there are several scenarios where working with the WordPress database might be necessary. One of the most common reasons is if your site is suffering from slow performance.<\/p><h3 class=\"wp-block-heading\" id=\"h-what-causes-a-wordpress-database-to-slow-down-nbsp\">What Causes a WordPress Database to Slow Down?&nbsp;<\/h3><p>There are several reasons your website may run slower than you&rsquo;d like, and your web hosting provider might be the culprit.&nbsp;<\/p><p>That&rsquo;s because the host determines the speed data travels between the site&rsquo;s server and visitors&rsquo; devices. When you have limited server space, you may discover that shared hosting is not a great fit for every type of website.<\/p><p>If your server is limited, there is a specific cap to what can be achieved regardless of your optimization efforts. To resolve this, choose a better <a href=\"\/my\/wordpress-hosting\" target=\"_blank\" rel=\"noreferrer noopener\">WordPress hosting<\/a> plan.<\/p><?xml encoding=\"utf-8\" ?><figure class=\"wp-block-image size-large\"><a href=\"\/my\/wordpress-hosting\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" width=\"1024\" height=\"300\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/06\/New-WP_in-text-banner-1024x300.png\" alt=\"\" class=\"wp-image-111781\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/06\/New-WP_in-text-banner-1024x300.png 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/06\/New-WP_in-text-banner-300x88.png 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/06\/New-WP_in-text-banner-150x44.png 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/06\/New-WP_in-text-banner-768x225.png 768w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/06\/New-WP_in-text-banner-1536x450.png 1536w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/06\/New-WP_in-text-banner.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><p>Other issues affecting a site may be a result of its design. For example, the <a href=\"\/my\/tutorials\/what-is-a-wordpress-theme\" target=\"_blank\" rel=\"noreferrer noopener\">WordPress theme<\/a> that you choose can dramatically affect performance.&nbsp;<\/p><p>Therefore, it&rsquo;s wise to pick your theme carefully. Complex and resource-heavy features may initially seem tempting. However, you may consider getting rid of them in favor of supporting a smoother <a href=\"\/my\/tutorials\/what-is-ux-design\" target=\"_blank\" rel=\"noreferrer noopener\">user experience (UX)<\/a>.<\/p><p>Additionally, <a href=\"\/my\/tutorials\/how-many-plugins-are-too-many\" target=\"_blank\" rel=\"noreferrer noopener\">excessive use of plugins<\/a> can negatively affect your site&rsquo;s speed. While having a large number of extensions doesn&rsquo;t automatically mean a website will be slower, it increases the risk that you&rsquo;ll end up using poorly coded or &ldquo;weighty&rdquo; plugins.<\/p><p>Similarly, certain plugins can consume large amounts of resources. Therefore, it&rsquo;s best to stick with only the most fundamental tools. You&rsquo;ll also want to ensure they are well reviewed, employ efficient code, and receive regular updates.<\/p><p>Another issue that can cause slowdowns is using large <a href=\"\/my\/tutorials\/optimize-images-wordpress\/\" target=\"_blank\" rel=\"noreferrer noopener\">image files that aren&rsquo;t optimized<\/a>, or simply having too much data on a single page. However, if none of these reasons seem to apply, you may have issues that can only be remedied within your WordPress database.<\/p><h3 class=\"wp-block-heading\" id=\"h-common-issues-that-affect-a-wordpress-database\">Common Issues That Affect a WordPress Database<\/h3><p>As mentioned earlier, everything you do on your WordPress website is saved in your database. It&rsquo;s a practical and essential element. Still, it presents a critical issue as it often generates a lot of unnecessary content on your site&rsquo;s back end.<\/p><p>For instance, in addition to the information you&rsquo;ll likely see as crucial, such as finalized post data, your database will also record every post revision by default. Additionally, your WordPress site keeps a record of all your comments, including spam messages.<\/p><p>Some of the common issues that can bloat your WordPress database are:<\/p><ul class=\"wp-block-list\">\n<li><strong>Accumulated spam comments<\/strong> &ndash; a large number of spam comments can negatively affect the speed of your database. Moreover, it can leave a wrong impression on visitors or anyone who wants to share genuine and valuable comments. This can lead users to believe that your website is untrustworthy.<\/li>\n\n\n\n<li><strong>Post revisions<\/strong> &ndash; WordPress records all the changes, revisions, and drafts you make. This can become an issue for very active blogs. They can fill up the database and slow down the server. WordPress stores an autosave every 60 seconds with a chronological record of edits made.<\/li>\n\n\n\n<li><strong>Expired <\/strong><a href=\"https:\/\/developer.wordpress.org\/apis\/handbook\/transients\/\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>transients<\/strong><\/a> &ndash; these are WordPress database functions that allow developers to keep or cache important information in a database. WordPress does not erase expired transients, even when they&rsquo;re no longer needed.<\/li>\n\n\n\n<li><strong>Deleted items<\/strong> &ndash; whenever you remove something like a post or page, it isn&rsquo;t gone entirely. Instead, it remains in your <strong>Trash<\/strong> folder. While this is often an invaluable tool, the deleted content can take up a lot of space if you don&rsquo;t remove it from time to time.<\/li>\n\n\n\n<li><strong>Unused tables<\/strong> &ndash; almost all WordPress plugins store their settings in the database. However, WordPress doesn&rsquo;t remove that data once you&rsquo;ve deleted a plugin from a site. This can become an issue if you often add and delete plugins regularly.<\/li>\n<\/ul><p>Over time, unused data will build up and slow down your website. You&rsquo;ll need to optimize your WordPress database to remove it.<\/p><h2 class=\"wp-block-heading\" id=\"h-why-is-wordpress-database-optimization-essential\">Why Is WordPress Database Optimization Essential?<\/h2><p>The more unnecessary data your WordPress database holds the slower your website gets. No matter how careful you think you&rsquo;ve been, it&rsquo;s challenging to stay on top of deleting everything you should. Therefore, every database will need maintenance at some point in time.<\/p><p>If you neglect WordPress database optimization, you&rsquo;ll get stuck with a slow website, which will cause significant problems in the long run. For starters, site speed is one of the factors that search engines such as Google use to determine page rankings.&nbsp;<\/p><p>Performance is crucial for your <a href=\"\/my\/tutorials\/what-is-seo\/\" target=\"_blank\" rel=\"noreferrer noopener\">search engine optimization (SEO)<\/a> strategy. If your website isn&rsquo;t up-to-speed, it won&rsquo;t perform well in the search results. As a result, new users will be far less likely to find your pages, products, and content.<\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/09\/ASOS-fashion-and-cosmetic-retailer-front-page.png\"><img decoding=\"async\" width=\"1024\" height=\"588\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/09\/ASOS-fashion-and-cosmetic-retailer-front-page-1024x588.png\" alt=\"ASOS fashion and cosmetic retailer front page\" class=\"wp-image-63670\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2022\/09\/ASOS-fashion-and-cosmetic-retailer-front-page.png 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2022\/09\/ASOS-fashion-and-cosmetic-retailer-front-page-300x172.png 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2022\/09\/ASOS-fashion-and-cosmetic-retailer-front-page-150x86.png 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2022\/09\/ASOS-fashion-and-cosmetic-retailer-front-page-768x441.png 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div><p>Keep in mind that site speed is a sliding scale, with faster websites reaping the rewards. Every second you speed up your website is crucial to increasing engagement and boosting your conversions.<\/p><p>However, this isn&rsquo;t the only reason you may want to optimize your WordPress database. Optimization also allows you to free up space for other tools and functionality. This is also a must if you&rsquo;re on a limited storage plan.<\/p><h2 class=\"wp-block-heading\" id=\"h-how-to-optimize-your-wordpress-database-3-ways\">How to Optimize Your WordPress Database (3 Ways)<\/h2><p>If you&rsquo;re determined to optimize your WordPress database, there are several ways to approach this. Fortunately, plenty of user-friendly options are available that don&rsquo;t require you to understand all the ins and outs of WordPress <a href=\"\/my\/tutorials\/database-schema\" target=\"_blank\" rel=\"noreferrer noopener\">database schema<\/a>.<\/p><h3 class=\"wp-block-heading\" id=\"h-1-manual-wordpress-database-optimization\">1. Manual WordPress Database Optimization<\/h3><p>The first method is the manual approach. You might prefer this option if you want to avoid adding any new plugins to your site. In addition, you may want to use this method if you&rsquo;re deleting a WP table altogether.<\/p><p>Before you start, it&rsquo;s important to <a href=\"\/my\/tutorials\/export-mysql-database-with-phpmyadmin\" target=\"_blank\" rel=\"noreferrer noopener\">back up the existing WordPress database<\/a>. This way, if something goes wrong and you accidentally delete important data, you&rsquo;ll be able to recover it. There are <a href=\"\/my\/tutorials\/backups\/downloading-website-backup\" target=\"_blank\" rel=\"noreferrer noopener\">several ways to download backed-up data<\/a>, but we recommend opting for whatever tools you&rsquo;re most comfortable with.<\/p><ol class=\"wp-block-list\">\n<li>&nbsp;Once you&rsquo;ve backed up your database, open <strong>phpMyAdmin<\/strong> via your hosting provider. If your site is managed here at Hostinger, you can start by <a href=\"\/my\/tutorials\/hpanel-tutorial\" target=\"_blank\" rel=\"noreferrer noopener\">accessing the hPanel<\/a>. Then, open <strong>phpMyAdmin<\/strong> in the <strong>Databases<\/strong> section and select which database you want to optimize. <\/li>\n<\/ol><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/02\/hpanel-databases-phpmyadmin-highlighted.jpg\"><img decoding=\"async\" width=\"1024\" height=\"431\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/02\/hpanel-databases-phpmyadmin-highlighted-1024x431.jpg\" alt=\"Accessing phpMyAdmin on hPanel\" class=\"wp-image-78205\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/02\/hpanel-databases-phpmyadmin-highlighted.jpg 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/02\/hpanel-databases-phpmyadmin-highlighted-300x126.jpg 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/02\/hpanel-databases-phpmyadmin-highlighted-150x63.jpg 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/02\/hpanel-databases-phpmyadmin-highlighted-768x323.jpg 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div><ol class=\"wp-block-list\" start=\"2\">\n<li>Next, select the <strong>Databases<\/strong> tab and choose the <a href=\"\/my\/tutorials\/wordpress\/how-to-find-out-wordpress-database-name\" target=\"_blank\" rel=\"noreferrer noopener\">WordPress database name<\/a> you wish to optimize.<\/li>\n<\/ol><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/09\/Selecting-a-WordPress-database-name-on-phpMyAdmin.jpg\"><img decoding=\"async\" width=\"1024\" height=\"461\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/09\/Selecting-a-WordPress-database-name-on-phpMyAdmin-1024x461.jpg\" alt=\"Selecting a WordPress database name on phpMyAdmin\" class=\"wp-image-63672\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2022\/09\/Selecting-a-WordPress-database-name-on-phpMyAdmin.jpg 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2022\/09\/Selecting-a-WordPress-database-name-on-phpMyAdmin-300x135.jpg 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2022\/09\/Selecting-a-WordPress-database-name-on-phpMyAdmin-150x67.jpg 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2022\/09\/Selecting-a-WordPress-database-name-on-phpMyAdmin-768x345.jpg 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div><ol class=\"wp-block-list\" start=\"3\">\n<li>Now select <strong>Check all<\/strong> to optimize all of the WP tables. Alternatively, you can select individual tables using the checkboxes on the left.<\/li>\n<\/ol><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/09\/Selecting-all-WordPress-tables-to-be-optimized-on-phpMyAdmin.jpg\"><img decoding=\"async\" width=\"1024\" height=\"673\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/09\/Selecting-all-WordPress-tables-to-be-optimized-on-phpMyAdmin-1024x673.jpg\" alt=\"Selecting all WordPress tables to be optimized on phpMyAdmin\" class=\"wp-image-63673\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2022\/09\/Selecting-all-WordPress-tables-to-be-optimized-on-phpMyAdmin.jpg 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2022\/09\/Selecting-all-WordPress-tables-to-be-optimized-on-phpMyAdmin-300x197.jpg 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2022\/09\/Selecting-all-WordPress-tables-to-be-optimized-on-phpMyAdmin-150x99.jpg 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2022\/09\/Selecting-all-WordPress-tables-to-be-optimized-on-phpMyAdmin-768x504.jpg 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div><ol class=\"wp-block-list\" start=\"4\">\n<li>After selecting the tables, click on the <strong>With selected:<\/strong> window and choose <strong>Optimize Table<\/strong> from the drop-down menu.<\/li>\n<\/ol><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/09\/right-click-and-choose-Optimize-Table-from-the-drop-down-menu.jpg\"><img decoding=\"async\" width=\"1024\" height=\"673\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/09\/right-click-and-choose-Optimize-Table-from-the-drop-down-menu-1024x673.jpg\" alt=\"Right-click and choose Optimize Table from the drop-down menu\" class=\"wp-image-63674\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2022\/09\/right-click-and-choose-Optimize-Table-from-the-drop-down-menu.jpg 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2022\/09\/right-click-and-choose-Optimize-Table-from-the-drop-down-menu-300x197.jpg 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2022\/09\/right-click-and-choose-Optimize-Table-from-the-drop-down-menu-150x99.jpg 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2022\/09\/right-click-and-choose-Optimize-Table-from-the-drop-down-menu-768x504.jpg 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div><ol class=\"wp-block-list\" start=\"5\">\n<li>This will optimize your database by defragmenting the selected WP tables. It should make your queries run faster and reduce the size of your database. Once complete, you&rsquo;ll receive a message, <strong>&ldquo;Your SQL query has been executed successfully.&rdquo;<\/strong><\/li>\n<\/ol><h3 class=\"wp-block-heading\" id=\"h-2-automatic-wordpress-database-optimization\">2. Automatic WordPress Database Optimization<\/h3><p>WordPress also comes with a built-in automatic database optimization tool. This method is somewhat more complicated than others on this list, as it will require you to edit your site&rsquo;s <strong>wp-config.php<\/strong> file. As previously, we recommend backing up your database before starting.<\/p><ol class=\"wp-block-list\">\n<li>The <strong>wp-config.php<\/strong> file is located in your site&rsquo;s root folder. You can access it via hPanel&rsquo;s file manager or an <a href=\"\/my\/tutorials\/ftp\/filezilla-ftp-configuration\" target=\"_blank\" rel=\"noreferrer noopener\">FTP client<\/a>.<\/li>\n<\/ol><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/04\/hpanel-dashboard-filemanager-highlighted.png\"><img decoding=\"async\" width=\"1024\" height=\"627\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/04\/hpanel-dashboard-filemanager-highlighted-1024x627.png\" alt=\"hPanel dashboard, File manager highlighted\" class=\"wp-image-83743\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/04\/hpanel-dashboard-filemanager-highlighted.png 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/04\/hpanel-dashboard-filemanager-highlighted-300x184.png 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/04\/hpanel-dashboard-filemanager-highlighted-150x92.png 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/04\/hpanel-dashboard-filemanager-highlighted-768x470.png 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div><ol class=\"wp-block-list\" start=\"2\">\n<li>Once you locate the file, you can download and edit it using a text editor such as <strong>Windows Notepad <\/strong>or <a href=\"https:\/\/notepad-plus-plus.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">Notepad++<\/a>. Alternatively, you can edit the <strong>wp-config.php<\/strong> file inside hPanel by double-clicking on it.<\/li>\n<\/ol><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/03\/filemanager-wpconfig-selected.png\"><img decoding=\"async\" width=\"1024\" height=\"355\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/03\/filemanager-wpconfig-selected-1024x355.png\" alt=\"Opening the wp-config.php file on hPanel\" class=\"wp-image-79642\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/03\/filemanager-wpconfig-selected.png 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/03\/filemanager-wpconfig-selected-300x104.png 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/03\/filemanager-wpconfig-selected-150x52.png 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/03\/filemanager-wpconfig-selected-768x266.png 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div><ol class=\"wp-block-list\" start=\"3\">\n<li>Once you have the <strong>wp-config.php<\/strong> open, you&rsquo;ll need to add the following line:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">define( 'WP_ALLOW_REPAIR', true );<\/pre><p>This is best done by placing the new line above <code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">\"\/* That's all, stop editing! Happy blogging. *\/\",<\/code> as we&rsquo;ve done in the example below.<\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/03\/wp-config-allow-repair.png\"><img decoding=\"async\" width=\"1024\" height=\"853\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/03\/wp-config-allow-repair-1024x853.png\" alt=\"Modifying the wp-config.php file by placing a new command line\" class=\"wp-image-79643\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/03\/wp-config-allow-repair-1024x853.png 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/03\/wp-config-allow-repair-300x250.png 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/03\/wp-config-allow-repair-150x125.png 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/03\/wp-config-allow-repair-768x640.png 768w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/03\/wp-config-allow-repair.png 1246w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div><ol class=\"wp-block-list\" start=\"4\">\n<li>Now, save the <strong>wp-config.php<\/strong> file and close it. If you downloaded the file in order to edit on your computer, reupload it to replace the existing one.<\/li>\n\n\n\n<li>You can then access the optimization tool by going to <code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">http:\/\/www.yourwebsite.com\/wp-admin\/maint\/repair.php.<\/code> Remember to replace <strong>&ldquo;your website&rdquo;<\/strong> with your site&rsquo;s domain. Finally, you&rsquo;ll see an on-screen option to <strong>Repair and Optimize Database<\/strong>.<\/li>\n<\/ol><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/09\/Repairing-WordPress-database-problems-on-wp-adminmaintrepair.php_.jpg\"><img decoding=\"async\" width=\"1024\" height=\"521\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/09\/Repairing-WordPress-database-problems-on-wp-adminmaintrepair.php_-1024x521.jpg\" alt=\"Repairing WordPress database problems on \/wp-admin\/maint\/repair.php\" class=\"wp-image-63678\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2022\/09\/Repairing-WordPress-database-problems-on-wp-adminmaintrepair.php_-1024x521.jpg 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2022\/09\/Repairing-WordPress-database-problems-on-wp-adminmaintrepair.php_-300x153.jpg 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2022\/09\/Repairing-WordPress-database-problems-on-wp-adminmaintrepair.php_-150x76.jpg 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2022\/09\/Repairing-WordPress-database-problems-on-wp-adminmaintrepair.php_-768x391.jpg 768w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2022\/09\/Repairing-WordPress-database-problems-on-wp-adminmaintrepair.php_.jpg 1500w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div><p>When the process is complete, you&rsquo;ll need to return to the <strong>wp-config.php<\/strong> file and remove the added line.&nbsp;<\/p><p>Once again, if you downloaded the file, re-upload it to replace the existing copy. Leaving the line intact is a security risk because it allows anyone to access the repair page.<\/p><h3 class=\"wp-block-heading\" id=\"h-3-wordpress-database-optimization-with-plugins\">3. WordPress Database Optimization With Plugins<\/h3><p>Finally, let&rsquo;s discuss the easiest way to optimize your database using a <a href=\"\/my\/tutorials\/wordpress-database-plugins\" target=\"_blank\" rel=\"noreferrer noopener\">WordPress database plugin<\/a>. You can <a href=\"https:\/\/wordpress.org\/support\/article\/managing-plugins\/\" target=\"_blank\" rel=\"noreferrer noopener\">install and activate<\/a> all of these plugins via your WordPress dashboard.<\/p><p><strong>WP-DBManager<\/strong><\/p><p><a href=\"https:\/\/wordpress.org\/plugins\/wp-dbmanager\/\" target=\"_blank\" rel=\"noreferrer noopener\">WP-DBManager<\/a> is a simple plugin that allows you to optimize a WordPress database, as well as back up and restore files. With this tool, most of the work is done automatically upon installation.<\/p><p>Moreover, your options are limited, making it easier for newcomers to navigate. The plugin helps with getting rid of unwanted tables or fixing broken ones. It can also repair damaged files.<\/p><p>Once you&rsquo;ve installed and activated the plugin, you&rsquo;ll want to go to <strong>Database &rarr; Backup DB<\/strong> in order to safeguard your site. After that, go to <strong>Database &rarr; Optimize DB<\/strong>.<\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/09\/Optimizing-WordPress-database-with-WP-DBManager.png\"><img decoding=\"async\" width=\"1024\" height=\"601\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/09\/Optimizing-WordPress-database-with-WP-DBManager-1024x601.png\" alt=\"Optimizing WordPress database with WP-DBManager\" class=\"wp-image-63679\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2022\/09\/Optimizing-WordPress-database-with-WP-DBManager.png 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2022\/09\/Optimizing-WordPress-database-with-WP-DBManager-300x176.png 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2022\/09\/Optimizing-WordPress-database-with-WP-DBManager-150x88.png 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2022\/09\/Optimizing-WordPress-database-with-WP-DBManager-768x451.png 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div><p>Choose <strong>Yes<\/strong> for all the database tables you want to optimize. Then, scroll down to the bottom of the screen and select <strong>Optimize<\/strong>.<\/p><p><strong>WP-Optimize<\/strong><\/p><p><a href=\"https:\/\/wordpress.org\/plugins\/wp-optimize\/\" target=\"_blank\" rel=\"noreferrer noopener\">WP-Optimize<\/a> is an advanced tool that allows compressing, caching, and cleaning up a WordPress database. It is an all-in-one plugin, meaning you won&rsquo;t need to install other tools to perform different database optimization tasks.&nbsp;<\/p><p>This popular WordPress database optimization plugin lets you set schedules to run these processes automatically. It even provides a tool to compress images.<\/p><p>After you have installed and activated the plugin, navigate to the WordPress dashboard. Then, go to <strong>WP-Optimize &rarr; Database<\/strong>.<\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/09\/Optimizing-WordPress-database-with-WP-Optimize.png\"><img decoding=\"async\" width=\"1024\" height=\"627\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/09\/Optimizing-WordPress-database-with-WP-Optimize-1024x627.png\" alt=\"Optimizing WordPress database with WP-Optimize\" class=\"wp-image-63680\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2022\/09\/Optimizing-WordPress-database-with-WP-Optimize.png 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2022\/09\/Optimizing-WordPress-database-with-WP-Optimize-300x184.png 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2022\/09\/Optimizing-WordPress-database-with-WP-Optimize-150x92.png 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2022\/09\/Optimizing-WordPress-database-with-WP-Optimize-768x470.png 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div><p>Here, it&rsquo;s best to take the time to examine all the potential optimization options thoroughly. Go ahead and select\/deselect the options as you see fit. You&rsquo;ll also notice that the plugin suggests downloading a backup tool before proceeding.&nbsp;<\/p><p>Completing this preliminary step is a good idea if you don&rsquo;t already have a backup tool installed. When ready for a WordPress database cleanup, click on <strong>Run all selected optimizations<\/strong>.<\/p><p><strong>Advanced Database Cleaner<\/strong><\/p><p><a href=\"https:\/\/wordpress.org\/plugins\/advanced-database-cleaner\/\" target=\"_blank\" rel=\"noreferrer noopener\">Advanced Database Cleaner<\/a> is designed exclusively to help you clean up the WordPress database. It will delete old revisions, alongside elements like trackbacks, pending comments, old drafts, and anything else causing unnecessary bloat.&nbsp;<\/p><p>The plugin also features a quick setting module, options for how often the tool will run, and the ability to exclude anything you like from the optimization process.<\/p><p>When the plugin is installed and activated, go to <strong>Advanced DB Cleaner<\/strong> in your dashboard.<\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/09\/Optimizing-WordPress-database-with-Advanced-Database-Cleaner.png\"><img decoding=\"async\" width=\"1024\" height=\"691\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/09\/Optimizing-WordPress-database-with-Advanced-Database-Cleaner-1024x691.png\" alt=\"Optimizing WordPress database with Advanced Database Cleaner\" class=\"wp-image-63681\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2022\/09\/Optimizing-WordPress-database-with-Advanced-Database-Cleaner.png 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2022\/09\/Optimizing-WordPress-database-with-Advanced-Database-Cleaner-300x202.png 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2022\/09\/Optimizing-WordPress-database-with-Advanced-Database-Cleaner-150x101.png 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2022\/09\/Optimizing-WordPress-database-with-Advanced-Database-Cleaner-768x518.png 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div><p>You&rsquo;ll be on the <strong>General Clean-up<\/strong> tab by default. Like other tools, tick the checkboxes next to the elements you wish to delete.&nbsp;<\/p><p>Choose <strong>Clean<\/strong> from the drop-down menu and click <strong>Apply<\/strong>. You should have successfully performed a WordPress database cleanup.<\/p><h2 class=\"wp-block-heading\" id=\"h-preventing-future-wordpress-website-bloat-nbsp\">Preventing Future WordPress Website Bloat&nbsp;<\/h2><p>You should now be able to keep your WordPress database functioning at more optimum levels. However, even with these WordPress database optimization tools and strategies, it&rsquo;s still a good idea to prevent any unnecessary site bloat before it happens.&nbsp;<\/p><p>This way, you can <a href=\"\/my\/tutorials\/reduce-initial-server-response-time-wordpress\" target=\"_blank\" rel=\"noreferrer noopener\">reduce the time<\/a> required to maintain your web pages. Let&rsquo;s look at some best practices for <a href=\"\/my\/tutorials\/speed-up-wordpress\" target=\"_blank\" rel=\"noreferrer noopener\">WordPress speed optimization<\/a> to keep website bloat to a minimum.<\/p><h3 class=\"wp-block-heading\" id=\"h-spam\">Spam<\/h3><p>Too many spam comments can take up a lot of space in your database. Therefore, WordPress automatically deletes them after 30 days. Still, they can take up a tremendous amount of space, especially if you&rsquo;ve been a victim of an aggressive spam incident. The best way to confront this is through an <a href=\"\/my\/tutorials\/wordpress\/how-to-setup-wordpress-anti-spam-protection\" target=\"_blank\" rel=\"noreferrer noopener\">anti-spam plugin<\/a> such as <a href=\"https:\/\/akismet.com\" target=\"_blank\" rel=\"noreferrer noopener\">Akismet<\/a>.<\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/09\/Akismet-anti-spam-WordPress-plugin.png\"><img decoding=\"async\" width=\"1024\" height=\"338\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/09\/Akismet-anti-spam-WordPress-plugin-1024x338.png\" alt=\"Akismet anti-spam WordPress plugin\" class=\"wp-image-63682\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2022\/09\/Akismet-anti-spam-WordPress-plugin.png 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2022\/09\/Akismet-anti-spam-WordPress-plugin-300x99.png 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2022\/09\/Akismet-anti-spam-WordPress-plugin-150x49.png 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2022\/09\/Akismet-anti-spam-WordPress-plugin-768x253.png 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div><p>Furthermore, spam comments generally target older articles that already rank high on search engine results. This means that even temporary spam can seriously damage your SEO efforts. To avoid this, you can also disable comments on articles older than a particular number of days.<\/p><h3 class=\"wp-block-heading\" id=\"h-revisions\">Revisions<\/h3><p>If you use your site for blogging, you likely already know that making revisions are essential. However, you may not have realized that lengthy or heavily edited articles can have dozens or hundreds of rows in the database.<\/p><p>To reduce the number of revisions your database holds, add a line of code to your <strong>wp-config.php<\/strong> file. WordPress will only maintain a maximum of two revisions per post:<\/p><pre class=\"wp-block-preformatted\">define( 'WP_POST_REVISIONS', 2 );<\/pre><p>Alternatively, you can disable revisions entirely with this line:<\/p><pre class=\"wp-block-preformatted\">define( 'WP_POST_REVISIONS', false );<\/pre><p>However, you may not want to use this option unless you&rsquo;re confident you won&rsquo;t need to retrieve any old revisions. Further information on how to use this code can be found in the <a href=\"https:\/\/wordpress.org\/support\/article\/revisions\/\" target=\"_blank\" rel=\"noreferrer noopener\">official WordPress revisions documentation<\/a>.<\/p><h3 class=\"wp-block-heading\" id=\"h-transients\">Transients<\/h3><p>Developers use transients to store data temporarily in the database options table. However, expired records can be another strain on your database.&nbsp;<\/p><p>The best way to get rid of them is with a third-party plugin. Several high-quality options are available. If you suspect that transients are clogging up your site, you may want to consider using something like <a href=\"https:\/\/wordpress.org\/plugins\/artiss-transient-cleaner\/\" target=\"_blank\" rel=\"noreferrer noopener\">Transient Cleaner<\/a> or <a href=\"https:\/\/wordpress.org\/plugins\/transients-manager\/\" target=\"_blank\" rel=\"noreferrer noopener\">Transients Manager<\/a>.<\/p><h3 class=\"wp-block-heading\" id=\"h-deleted-items\">Deleted Items<\/h3><p>Almost everything you delete in WordPress doesn&rsquo;t get removed entirely. Instead, it goes into the <strong>Trash<\/strong> folder and is only gone when you empty the bin. While this failsafe can be handy, it can cause your database to become bloated.<\/p><p>As such, you should consider emptying these trash folders regularly. WordPress permanently deletes these files after 30 days by default, but you can make the process happen more often.<\/p><p>By adding the following line of code to the <strong>wp-config.php<\/strong> file, <a href=\"https:\/\/www.wpbeginner.com\/beginners-guide\/how-to-limit-or-disable-automatic-empty-trash-in-wordpress\/\" target=\"_blank\" rel=\"noreferrer noopener\">you can alter the limit number<\/a>:<\/p><pre class=\"wp-block-preformatted\">define( 'EMPTY_TRASH_DAYS', 7 );<\/pre><p>Here, we&rsquo;ve lowered it to just seven days, but you can enter whatever value you like.<\/p><h3 class=\"wp-block-heading\" id=\"h-unused-tables\">Unused Tables<\/h3><p>When you <a href=\"\/my\/tutorials\/wordpress\/how-to-install-wordpress-plugins\" target=\"_blank\" rel=\"noreferrer noopener\">install and activate a WordPress plugin<\/a>, it may automatically get its own table. However, when you delete the plugin, WordPress doesn&rsquo;t automatically remove that data.&nbsp;<\/p><p>Instead, it remains in place if you ever want to install the plugin again. If you swap out your plugins and install new ones regularly, this old data will cause problems like the <a href=\"\/my\/tutorials\/wordpress-error-establishing-database-connection\">error establishing database connection<\/a> issue.<\/p><p>Therefore, you&rsquo;ll want to clear up unused tables as a part of your WordPress database cleanup process.<\/p><p>While some plugins offer a built-in option to remove all data, most do not. That means it&rsquo;s something you&rsquo;ll need to do manually via the methods we&rsquo;ve discussed previously. Remember not to tweak the core tables; ensure that you back up your files before proceeding.<\/p><h2 class=\"wp-block-heading\" id=\"h-conclusion\">Conclusion<\/h2><p>WordPress database optimization is something every website owner needs to do at some point. In short, the longer your database is active, the more unnecessary information it will accumulate. However, removing this excess data doesn&rsquo;t have to be complicated.&nbsp;<\/p><p>To recap, here are three ways you can carry out WordPress database optimization:<\/p><ol class=\"wp-block-list\">\n<li>Manually via phpMyAdmin.<\/li>\n\n\n\n<li>Automatically using the built-in WordPress optimizer tool.<\/li>\n\n\n\n<li>Using such third-party plugins as WP-DBManager, WP-Optimize, or Advanced Database Cleaner.<\/li>\n<\/ol><p>Now you have the tools and knowledge to maintain a high-performing and lightweight WordPress database! If you have more questions or suggestions, feel free to share them in the comments section.<\/p><h2 class=\"wp-block-heading\" id=\"h-wordpress-database-optimization-faqs\">WordPress Database Optimization FAQs<\/h2><p>Here are some additional explanations about WordPress database optimization.<\/p><div class=\"schema-faq wp-block-yoast-faq-block\"><div class=\"schema-faq-section\" id=\"faq-question-1680761549350\"><h3 class=\"schema-faq-question\">What Is WordPress Database Optimization?<\/h3> <p class=\"schema-faq-answer\">WordPress database optimization is the process of cleaning and optimizing the WordPress database to <a href=\"\/my\/tutorials\/analyze-website-performance\">analyze and improve website performance<\/a>. This includes removing unnecessary data, optimizing database tables, and reducing the size of the database to ensure faster queries and a smoother overall user experience.<\/p> <\/div> <div class=\"schema-faq-section\" id=\"faq-question-1680761564429\"><h3 class=\"schema-faq-question\">What Are Some Common WordPress Database Optimization Mistakes?<\/h3> <p class=\"schema-faq-answer\">Some common WordPress database optimization mistakes include not backing up the database before making changes, not optimizing images and other media files, using too many plugins, not using a caching plugin, and not regularly cleaning up unused tables or data.<\/p> <\/div> <\/div>\n","protected":false},"excerpt":{"rendered":"<p>Your WordPress database stores all of your site&rsquo;s information. If it&rsquo;s become bloated with extra data, that can slow down your pages. Yet, at first glance, its numerous columns and settings can seem intimidating. Perhaps you&rsquo;re afraid that your efforts at WordPress database optimization might cause irreparable data loss. However, optimizing a WordPress database isn&rsquo;t [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"\/my\/tutorials\/wordpress-database-optimization\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":76,"featured_media":71594,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"WordPress Database Optimization: 3 Ways to Boost Site Speed","rank_math_description":"WordPress database optimization improves site speed and user experience. Learn how to optimize the site's database by reading this article.","rank_math_focus_keyword":"WordPress database optimization","footnotes":""},"categories":[],"tags":[],"class_list":["post-63658","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/tutorials\/wordpress-database-optimization","default":0},{"locale":"fr-FR","link":"https:\/\/www.hostinger.com\/fr\/tutoriels\/nettoyer-base-de-donnees-wordpress","default":0},{"locale":"en-UK","link":"https:\/\/www.hostinger.com\/uk\/tutorials\/wordpress-database-optimization","default":0},{"locale":"en-MY","link":"https:\/\/www.hostinger.com\/my\/tutorials\/your-complete-guide-to-wordpress-database-optimization","default":0},{"locale":"en-PH","link":"https:\/\/www.hostinger.com\/ph\/tutorials\/your-complete-guide-to-wordpress-database-optimization","default":0},{"locale":"en-IN","link":"https:\/\/www.hostinger.com\/in\/tutorials\/wordpress-database-optimization","default":0},{"locale":"en-CA","link":"https:\/\/www.hostinger.com\/ca\/tutorials\/wordpress-database-optimization","default":0},{"locale":"en-AU","link":"https:\/\/www.hostinger.com\/au\/tutorials\/wordpress-database-optimization","default":0},{"locale":"en-NG","link":"https:\/\/www.hostinger.com\/ng\/tutorials\/wordpress-database-optimization","default":0}],"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/posts\/63658","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/users\/76"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/comments?post=63658"}],"version-history":[{"count":36,"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/posts\/63658\/revisions"}],"predecessor-version":[{"id":114972,"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/posts\/63658\/revisions\/114972"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/media\/71594"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/media?parent=63658"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/categories?post=63658"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/tags?post=63658"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}