Optimize WordPress Database with WP-Optimize
- 24-07-2022
- chuong xuan
- 0 Comments
The WP-Optimize plugin is an effective tool that helps us to clean the WordPress database automatically and thus achieve maximum website performance.
This is my favorite plugin to use with several others like WP Fastest Cache (create static pages), EWWW Image Optimizer (optimize images), Autoptimize (optimize HTML, CSS, JS) and AMP for WordPress (optimized for mobile internet connection) to provide the best site speed (*).
(*): Note, in addition to the above plugins, I have some other suggestions for your reference:
- If you have money to buy, please refer to one of the following two cache plugins, WP-Rocket and Swift Performance
- Short Pixel is a very good image compression plugin worth trying, even the paid version is reasonably priced with most sites, see more Short Pixel usage guide here.
Mục lục
main fuction
- Removes all unnecessary data (e.g. spam, unapproved comments, trash, stale data) plus optional extras pingbacks, trackbacks
- Compress/defrag MySQL tables with the push of a button
- Fine-grained control, specifically what optimizations you want to make
- Do weekly cleaning and optimization (or other schedule you want)
- Perform optimizations without running manual queries
- Automatically enable data backup before optimization via UpdraftPlus plugin
- Display statistics for the database and predict space savings
- Mobile friendly and easy to use interface
- Translated into several languages
WP-Optimize plugin helps you
- Spatial Expansion : When you edit a post or page on your site, WordPress automatically saves the new revisions to the database. If you edit an article many times (and especially if the post is long), your database will quickly fill up with old revisions that are no longer worth using and take up storage space. precious. behave. The WP-Optimize plugin removes unnecessary modifications, delivers megabytes of valuable data, and boosts speed and performance. It also cleans the comment data table, removing all spam and disapproved comments with just one click.
- Control : WP-Optimize reports exactly which database tables are wasting space, giving you the insight and customization capabilities to keep your site fast and performing.
- Keep things clean and clear : When enabled, WP-Optimize can automatically clean up junk data on a schedule, keeping it for as many weeks as you want.
When you are using this plugin for the first time or it has just been updated, please backup your database (we recommend UpdraftPlus). Although no malicious queries are used, you should back up the database before making any changes to the database.
How does it help you?
- Data tables in MySQL (the database that WordPress uses) will become less efficient over time as data is added, deleted, and moved back and forth. Tell MySQL to optimize its data tables as soon as possible, and repeating this will get your site running as fast as possible. That won't happen on its own, you need a plugin to do it.
- Every time you save a new post, WordPress creates a revision of that post. If you edit an article 6 times, you can have 5 copies of that article as revisions. This will quickly push more (rarely used) data into your database tables, making them unnecessarily cumbersome and slow to access.
- Similar to the scenario described above, there can be thousands of spam and unapproved comments in the comment data table, WP-Optimize can clean and remove them with a single click.
- WP-Optimize reports data tables that contain wasted space and allows to shrink and remove that wasted space.
- Automatically cleans the database on a weekly basis and offers an option to "keep old data for a few weeks".
WP-Optimize premium version
The free version of WP-Optimize is great, but they also offer a premium, paid version that's even more powerful with many extended features that offer complete freedom and extreme flexibility :
- Multisite support : extend the database optimization capabilities so that they work for multiple WordPress sites at the same time. If you manage multiple sites, you will need the WP-Optimize Premium version.
- Flexibility and control : gives you the power to optimize a specific table or a combination of certain tables in one or more pages instead of optimizing the entire database table.
- Optimize images : remove unused images in a WordPress site, along with images of a certain, predefined size.
- More granular scheduling : provides a variety of options in auto-optimizing scheduling. Specific time and run scans daily, weekly, twice a week or monthly and perform any number of additional optimizations.
- Seamless graphical user interface: the planning interface, multi-site optimization management is extremely clear.
- WP-CLI support : provides optimized management from the command line interface.
Instructions for using the plugin WP-Optimize
After installation, you go to the WP-Optimize tab for optimization. The default options will look like this:
You may see a message that my site uses InnoDB (41) database so these tables will not be optimized, while other tables will be optimized (other tables will be optimized). chemical – 21). You should check the box Optimize database tables (I forgot to check it in the image above), and the InnoDB Optimization section should not be checked.
Explain what the options and notices in the image above mean (specific numbers will vary, depending on your website).
- Clean all post revision: 882 post revisions in your databases e means my site has 882 versions archived to restore posts in the database, ticking this will delete these data. Advice: should tick.
- Clean all auto-draft: 8 auto draft post in your database means my site has 8 drafts automatically saved in the database, ticking this will delete this data. Advice: should tick.
- Clean all trashed post: 3 trashed posts in your database That means there are 3 posts in the trash, ticking here will delete this data. Advice: should tick.
- Remove spam and trashed comments: 1020 spam comments found ie remove spam comments and comments to the trash. Advice: you should check it, you can review the reviews in the spam section to see if it is true that the comments are spam or not, and then delete them all.
- Remove unapproved comments: 14 unapproved comments found It means there are 14 unapproved comments, ticking here will delete all these comments. Advice: do not check in hastily, you should go to see these unapproved comments specifically and delete them later, it's not too late.
Advanced options:
- Remove expired transient options ie remove temporary options. Right now I don't know the meaning of this choice.
- Remove pingbacks means delete pingbacks, if you yourself are the one who turns on pingbacks, you should not tick to delete it.
- Remove trackbacks means delete trackbacks, similarly, if you're the one who turned on trackbacks, you shouldn't tick to remove it. To dig deeper into the meaning and difference between pingback and trackback
- Clean post meta data means to delete the post metadata in the database. In the message in the photo above, it says it has 58 metadata that isn't used for anything and may need to be deleted.
- Clean comment metadata means removing comment metadata as well as rows of Akismet data (extremely powerful plugin in anti-spam). In the above message, it says that there are 19 012 rows of Akismet data that have not been used.
- Clean orphaned relationship data means to remove unused relational data.
Note: Items highlighted in red perform more intensive database operations. In very rare cases, if the server operating your database crashes, hangs at the same time as the optimization process is in progress, the data can be corrupted. You may want to back up before performing optimizations.
After ticking all the options you want. You tick the following option if you use the UpdraftPlus plugin, it will help your website to be backed up (if you don't use this plugin you don't need to check / and can't check):
Finally, you click Run all selected optimizations to perform optimizations.
Table Information
Information about tables is located on the Table information tab. Here it tells us the table name ( Table ), number of Records (records), database size ( Data Size ), data type ( Type ):
Setting
Information about the settings is in the Settings tab. Here you set up some settings regarding the backup schedule as well as how long old data is stored.
General settings / General settings
This (last hold) setting allows to retain 2 weeks of data from the selected interval and delete the previous junk data. And Enable admin bar link means enable showing admin bar for WP-Optimize on top admin bar.
If you want to schedule automatic database optimization, tick as shown below:
Finally click Save Settings to save the settings.
Practical experience
I consider WP-Optimize to be a general site cleaning process, so I don't actually use it too often. Only turn it on once or twice a year for cleaning and then turn it off again.
Because cleaning too often is not necessarily helpful, for example keeping old revisions can be extremely valuable if we need to use it (this is like an old item in If we don't have old, little used things, we throw them in the trash, because a few months after we need them, we'll still have something to use).
OK, of course that's true for me. You may have other options that are more suitable for you.
Some questions
Is my data safe?
Right; optimizer doesn't do any "tricks" or interfere in a dangerous way. The cleanup queries used are well-defined, common MySQL statements. However, we always encourage you to back up for any possibility; not only the backbone of the database but also hackers, human error, etc.
What can I expect my site to save?
This completely depends on your site – how big it is, how many users interact with it, how long it's been around, and when it was last optimized. Anyway, the space savings and speed improvements are substantial; really worth it to make sure your database is optimized.
WP-Optimize doesn't give any significant savings to my database
This is a rare case; it could be because you are on a shared hosting plan and the hosting company that sells the hosting package does not allow you to run optimized code through SQL statements. Ask your hosting company about this.
Is this plugin tried and tested?
That's right – WP-Optimize is the most installed plugin in its respective field, with over 500,000 users and has been in development for over 7 years.
Does WP-Optimize support InnoDB tables?
WP-Optimize will disable some features if it treats the data table as InnoDB. The on-disk database table optimization is not available, but the cleanup features still work.
Is there any error in this plugin?
Plugins continue to grow; That means it's impossible to rule out all unforeseen circumstances and possible errors. So I encourage you to test it on your localhost or take a backup of the database (as a precaution).
Can you help me restore the database?
We fear that this is not possible. Make sure you create a full database backup before using WP-Optimize for the first time or when you have a major update to a new version. We recommend using UpdraftPlus to do this.
Hello and see you in another post.