Are looking to optimize your WordPress Database to improve your website loading time. you are at the right place keep reading this post. In this post, I will explain to you How to optimize your WordPress database. If a website load faster, it is very useful for SEO. Google rank higher a website in search results. There is a number of factors which decide website loading time one of them is WordPress database size. There is a number of ways to optimize WordPress database, the easiest way is to use a database optimizer plugin. More the plugin you use more the database size Will be, in this post we will talk about How you can optimize WordPress database size using phpMyAdmin.
Overview of WordPress Database Structure -:
WordPress Database has two major feature First is to WordPress Installation itself and second is the contents of the wp-content directory which includes the themes, plugins and uploads. WordPress Database is stored on the table. In the current version of WordPress, there are 11 tables which are as follow. WordPress Database has two major segments. First is to WordPress installation itself and second is the contents of the wp-content directory which includes the themes, plugins and uploads.
If you see above database table each table saves a specific type of data. When we install WordPress 11 default table automatically get created all other tables which you see in your data are created by WordPress Plugin and Theme. More you use WordPress Plugin and Them more your Database size will be. Let’s look at what each database table stores:
wp_commentmeta – Stores meta-information about comments
wp_comments – Stores your comments
wp_links – Stores blogroll links (blogroll feature is deprecated, but can be added using Link Manager)
wp_options – Stores the options defined in the admin settings area
wp_postmeta – Stores post meta information
wp_posts – Stores data for posts, pages, and other custom post types
wp_terms – Stores post tags and categories for posts and links
wp_term_relationships – Stores the association between posts and categories and tags and the association between links and link categories
wp_term_taxonomy – Stores a description about the taxonomy (category, link, or tag) used in the wp_terms table
wp_usermeta – Stores meta-information about users
wp_users – Stores your users
1. How to Optimize WordPress Database using phpMyAdmin-:
There is a number of ways to optimize WordPress Database like using the plugin, modifying the wp-cong.php file or running SQL query to clean and optimize database. In this post, I will talk about How to optimize WordPress database using phpMyAdmin panel. Database is core files so it is strongly recommended to take a backup of your core files. Most of the hosting provider provides cPanel to access back end of WordPress website. Go to your Hosting cPanel >go to database>phpmyadmin.
Once you log on to your phpMyAdmin you will see all tables. Your database size depends upon your theme, no. Of plugin installed, post revision and autosave . Select all table and click optimize. If your WordPress website database corrupted, use the Repair table option.
2.Control Post Revision with Modification in the wp-config file-:
Creating an awesome post requires lots of brainstorming and lots of revision of an article. it happens with blogger, after editing an article you may feel that the previous version was better. Post revision backup is an awesome feature of WordPress that allow the user to undo the revision. WordPress does not have a limitation on post revision.
WordPress in default saves 30 revision of a post. It is quite obvious that these databases consume your space and increase database size. You can control the number of post revision by adding the following code to your WordPress wp-config file. Add the following code anywhere before the code require_once(ABSPATH . ‘wp-settings.php’);
define ('WP_POST_REVISIONS', 3);
In the above code, WordPress will save only the last three revision you can increase that number as per your requirements.
3.Control AutoSave in WordPress with wp-config file-:
While writing post most of the time we forget to save our post on an equal interval of time. WordPress saves a post after every 60 seconds. These saving of post every 60 seconds increase the database size. If you think you want autosave option little bit more time then add following code to your wp-config file. Add the following code anywhere before the code require_once(ABSPATH . ‘wp-settings.php’);
define( 'AUTOSAVE_INTERVAL', 240 );
240 is the number of seconds which you can soft as per your requirement.
4.Control Trash in WordPress-:
Editing or deleting a blog post is a part of bloggers daily life. With time some of the blog posts get outdated which blogger delete. WordPress has a default feature to keep the selected item in the trash folder for 30 days after that it will get selected permanently. If you have deleted a large number of post them your trash folder will increase your database size. You can control your trash folder holding time with the addition of the following code to your wp-config file.Add the following code anywhere before the code require_once(ABSPATH . ‘wp-settings.php’);
define( ‘EMPTY_TRASH_DAYS’, 10 );
Above code, the trash holding time is 10 days. You can set it as per your requirement.
Conclusion-: In this post, I have tried in my best way to optimize WordPress database. If you do not want to configure your wp-config file, you can use the Database Optimizer Plugin. If you have any other way to optimize the database let me know in the comment.
If you like my work, Please Share on Social Media! You can Follow WP knol on Facebook, Twitter, Pinterest, Quora and YouTube for latest updates. You may Subscribe to WP Knol Newsletter to get latest updates via Email. You May also Continue Reading my Recent Posts Which Might Interest You.
Hi, I am Amar Patel from India. Founder, Author and Administrator of wpknol.com. I am a Simple Average Man who Loves life and Love living life.Professionally I am a Mechanical Engineer. Apart from my Job, I Love to write the things around WordPress WordPress CMS.