iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
Antihost offers managed WordPress hosting with free migration, one-click staging and a 14-day free trial.
The safest way to reduce a WordPress database is to back up the database and site files, measure what is large, remove only confirmed disposable records, then optimize the tables and test the site. Database cleanup and table optimization are different operations: deleting revisions or expired transients removes rows, while optimization asks the database engine to reorganize or reclaim storage. Do them in that order, and keep a rollback copy until the site has run normally.
What database cleanup can—and cannot—achieve
A WordPress database contains posts, pages, comments, settings, metadata, taxonomy relationships, scheduled data and records created by plugins. A large database is not automatically unhealthy. A busy site with years of content, many comments or an ecommerce plugin may legitimately need substantial storage.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →There is no universal safe reduction target in megabytes. The result depends on revision history, comment volume, plugin tables, transient churn, autoloaded options, indexes, the database engine and how long you retain backups. Measure your own tables before deciding whether a cleanup is worthwhile.
- Record cleanup removes data you have deliberately identified as disposable, such as old revisions, auto-drafts, spam comments and expired transients.
- Table optimization runs an engine-level operation after cleanup. It may reorganize data or reclaim free space, depending on the database engine and table layout; it does not decide which WordPress records are safe to delete.
- Autoload auditing addresses request performance. Large autoloaded options are loaded on ordinary WordPress requests even when the related feature is not being used, so they can slow the site without contributing much to the dump’s total megabytes.
Back up the database and files before touching data
A database export contains posts, pages, comments and settings, but it does not contain your themes, plugins, uploads or wp-config.php. A usable rollback therefore needs two separate backups.
#1 Best Overall
- 110 Sheets Log Book: This vehicle maintenance log book includes 110 record sheets to track repairs, services, fuel costs, and other vehicle-related expenses. It also comes with 36 convenient “Service Due” stickers to help remind you of upcoming maintenance schedules. Everything you need to keep your car records organized in one place.
- Detailed Information: Each page is carefully structured with dedicated sections for date, mileage, service description, parts replaced, vehicle information, cost, and additional notes. The clear and organized format allows you to maintain accurate records, monitor repair history, and better manage long-term vehicle performance and expenses.
- Enough Writing Space: The record sheets provide ample space for clear and thorough entries. Whether you’re documenting routine oil changes or major repairs, there’s plenty of room to write detailed information without feeling cramped.
- Easy to Use: The spiral binding allows the notebook to lay flat for comfortable writing, making entries quick and convenient. The included 36 “Service Due” stickers can be placed inside the book or on visible surfaces like your windshield or dashboard, helping you keep important maintenance reminders in sight.
- Proper Size: This compact logbook measures 5.5” x 7.1”, which fits easily in your glove compartment, center console, backpack, or desk drawer. Its portable size ensures you can access and update your vehicle records anytime, whether at home, in the garage, or at the service center.
- Export the database. Use your host’s database-export tool or a trusted command-line export. Confirm that the export completes and can be downloaded.
- Copy the WordPress files. Include
wp-content(themes, plugins and uploads),wp-config.phpand any web-server configuration or custom files your host requires. - Keep the copies together. Label both with the same date and site name so you can restore a matching database and file set.
- Store an off-site copy. A second location protects you if the server, control panel or local backup fails. An external drive is useful when its capacity is chosen for the full database-plus-files backup set, not just the current database.
- Use staging when possible. Clone the site, run the cleanup on staging first, and check that the clone can log in, publish and execute scheduled tasks. Never assume a staging result is safe until the production backup has also been verified.
Do not start a deletion if the export is empty, truncated, unreadable or stored only on the same server. A backup that has never been checked is not a recovery plan.
Measure the baseline before deleting anything
Write down the total database size, each table’s size, row counts for the tables you plan to change, and the largest values in wp_options. Your installation may use a different table prefix; replace wp_ in examples with the prefix shown in your own configuration.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Clear out junk files and repair common Windows errors3Scan for outdated or missing drivers - takes under a minuteCapture table sizes
In a MySQL-compatible database, this query lists data and index storage from largest to smallest:
SELECT
table_name,
table_rows,
ROUND((data_length + index_length) / 1024 / 1024, 2) AS size_mb,
ROUND(data_free / 1024 / 1024, 2) AS free_mb
FROM information_schema.tables
WHERE table_schema = DATABASE()
ORDER BY (data_length + index_length) DESC;
table_rows can be an estimate for some storage engines, so use it for comparison rather than as an accounting guarantee. Save the result before and after each major change.
Find large options and autoloaded values
SELECT
option_name,
autoload,
LENGTH(option_value) AS bytes
FROM wp_options
ORDER BY bytes DESC
LIMIT 50;
Then isolate values marked for autoloading:
SELECT
option_name,
autoload,
LENGTH(option_value) AS bytes
FROM wp_options
WHERE autoload IN ('yes', 'on', 'auto', 'auto-on')
ORDER BY bytes DESC
LIMIT 50;
Record the top names and sizes, not just the total. An option name often identifies the owning plugin or theme, but confirm ownership in that product’s documentation or code before changing it.
Record functional checks
Before cleanup, note whether the site can log in, publish a post, submit forms, accept comments, run scheduled tasks, complete an ecommerce transaction (if applicable), search content and load any plugin features that write custom tables. These checks give you a meaningful comparison after the change.
Free tools Windows power users keep installed
One-click scans. No signup required.
Remove disposable WordPress records in a controlled order
Work in small batches. Take a fresh backup if the first batch is large, and measure after each category. Deleting directly in SQL bypasses WordPress hooks, so use a WordPress-aware tool when it provides the required operation; use SQL only when you understand the relationships and have a tested rollback.
1. Old post revisions
Revisions are useful for editorial rollback but can accumulate thousands of rows on a frequently edited site. Decide how many revisions editors genuinely need rather than deleting every revision by default. A site with legal, editorial or compliance requirements may need a longer history.
With WP-CLI, list revision IDs first, inspect the count, and delete only the IDs you have approved. A shell pattern that processes IDs in batches is safer than placing an unbounded list into one command:
Rank #2
- All In One Equipment Maintenance Log Book With Detailed Fields:This equipment maintenance log book is designed for complete tracking of machinery and equipment performance Featuring pre-printed sections for Equipment Name Manufacturer Name Model Number Serial Number Purchase Date Item Location and Additional Information this repair log book ensures accurate and consistent service records
- Includes Maintenance Schedule Fields for Time and Task Recording:Each page includes dedicated spaces for Date and Time Maintenance Task or Remarks Performed By and Cost helping you record maintenance frequency track service intervals and monitor expenses Ideal for preventive maintenance logs and repair history documentation
- Large Format Repair Log Book With Continuation Pages:Sized at 8.5 x 11 inches this equipment service record notebook provides generous space for writing and includes 110 Pages with continuation pages to extend entries when needed Ensures that even complex service reports are kept complete and organized
- Durable Spiral Bound Construction for Long Term Use:Built with a 300gsm laminated cover and strong spiral binding this maintenance log notebook lies flat for easy writing and endures frequent handling in demanding environments from factory floors to fieldwork sites
- Ideal for Industrial Commercial and Personal Equipment Tracking:Whether you’re managing heavy machinery in construction agricultural tools in farming or facility systems in schools or warehouses this maintenance record book helps technicians engineers and facility managers maintain consistent and accessible logs
wp post list --post_type=revision --format=ids | xargs -r wp post delete --force
Run this only after confirming that the command is pointed at the intended installation and that the backup is available. If you retain a deliberate number of revisions, select older IDs according to your retention rule instead of deleting all of them.
2. Auto-drafts and trashed posts
Auto-drafts are temporary posts created while someone starts an editor session. Trashed posts may be recoverable through the WordPress trash period. Emptying them is appropriate only after the content owner confirms that no restoration is needed.
List the records by post status, review the count and age, then delete in batches. Do not treat scheduled, private or pending posts as disposable merely because they are not public.
3. Spam and trashed comments
Spam and comments already placed in the trash are common sources of needless rows, especially on sites exposed to automated submissions. Before purging, check moderation or legal-retention requirements. Preserve approved comments and pending comments that still require review.
Use the comments screen or a WordPress-aware command so related metadata is handled consistently. If you inspect SQL, the relevant statuses are commonly represented by spam and trash in the comments table, but confirm your WordPress version and extensions before issuing a direct delete.
Recommended Free Tools
4. Expired transients
Transients are temporary cached values. Without a persistent object cache, they are typically stored in wp_options. Expired transients can leave rows behind even when they are not part of the autoloaded footprint.
Delete expired transients rather than indiscriminately deleting every transient. WP-CLI provides an expired-transient deletion operation:
wp transient delete --expired
Active transients may be recreated as soon as a plugin needs them. Seeing rows return after cleanup is therefore not proof that the cleanup failed or that the plugin is defective. If a transient grows continuously, identify the code that creates it and investigate its cache policy instead of scheduling increasingly aggressive deletion.
5. Orphaned plugin and theme data
Removing a plugin’s files does not guarantee that its tables and options were removed. Before deleting anything with a plugin-specific name:
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Rank #3
- Confirm that the plugin is no longer active and that no replacement plugin depends on its data.
- Read the plugin’s uninstall documentation or inspect its uninstall routine to learn whether removal is intended to be permanent.
- Check whether the data is needed for a future reinstallation, migration or audit.
- Back up the affected tables and options separately so they can be restored without restoring the entire site.
Unknown tables, serialized option values and metadata should be treated as live data until ownership and dependencies are established. Never delete a table solely because its name is unfamiliar.
Audit wp_options autoloaded data
WordPress’s Developer Handbook (2023) gives this general performance guideline: “Generally, you should try to keep your site’s autoloaded options under 800kb.” This is a target for investigation, not a universal hard limit. A site can function above it, and a smaller total does not guarantee fast requests if queries, code or external services are the real bottleneck.
Identify the owner of each large value
Start with the autoload query above. For each large option, search the option name in the active plugin and theme files, check the product’s documentation, and determine whether the value is configuration, a cache, a license record, a scheduled-task queue or something else. Serialized values may contain many settings; do not edit them as plain text unless the application provides a safe interface.
Change autoload behavior only when confirmed safe
If a plugin documents that an option is not needed on every request, use its settings or uninstall routine to change or remove it. An administrator who has verified the dependency can change an option’s autoload flag, for example:
UPDATE wp_options
SET autoload = 'no'
WHERE option_name = 'replace_with_verified_option_name';
Do not run this as a bulk update. Core options, active-theme settings, rewrite rules, authentication settings and plugin configuration may be required during normal requests. Changing an option to non-autoloaded can also expose code that incorrectly assumes the value is always preloaded.
Understand WordPress 6.6 behavior
WordPress 6.6 introduced behavior that can skip autoloading for large options when no explicit autoload value is supplied. That behavior does not make every large option harmless, nor does it remove the need to identify the owner. Existing explicit settings and plugin code still matter, and the exact result depends on how an option was created and updated.
Optimize tables after record cleanup
Once disposable rows are removed and the site is working on staging, optimize the tables. With WP-CLI:
wp db optimize
This runs mysqlcheck with --optimize=true. The command operates at the database-table level; it does not select revisions, comments, transients or orphaned plugin records for you. Depending on the database engine, optimization may reclaim free space, rebuild or reorganize storage, or produce little visible reduction in the dump size.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Run the command during a maintenance window when your host’s database service may lock or rebuild tables. Follow the host’s guidance for large production tables, and monitor the command until it completes. Do not interpret a small change in filesystem size as evidence that record cleanup was useless: indexes and engine allocation can mask row-level reductions.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Choose a cleanup method that matches your risk tolerance
| Capability | WP-Optimize | WP-CLI |
|---|---|---|
| Backup before cleanup | Advertises backup-before-cleanup support; verify that the backup destination and retention meet your requirements. | No general backup-before-cleanup workflow is established by the table-optimization command; create and verify your own database and file backups. |
| Revisions, auto-drafts, trashed posts, spam and trashed comments | Advertises cleanup for these categories. | The documented database command optimizes tables; record selection requires separate, WordPress-aware commands or another controlled method. |
| Expired transients | Advertises transient cleanup. | Supports an expired-transient deletion operation; active transients can return when code recreates them. |
| Orphaned plugin data | Do not assume automatic ownership detection; verify each plugin’s uninstall behavior. | Does not decide whether plugin tables or options are orphaned. |
| Autoload inspection | Use its inspection features only if the installed version exposes the data you need; ownership still requires verification. | Use SQL or a dedicated diagnostic workflow to inspect option names, sizes and autoload flags. |
| Staging and automation | Can be used on a staging copy; scheduling depends on the installed edition and configuration. | Works well in scripted or staging workflows, but scripts must define the records and retention policy explicitly. |
| Restoration | A backup feature is not a substitute for testing that the backup can be restored. | Restore from the database and file backups you created; the optimization command itself is not a restore mechanism. |
Whichever method you choose, review the proposed records before confirming a destructive action. A graphical interface reduces command-line mistakes but cannot know whether a particular plugin’s data is still valuable. A script is repeatable but can repeat a bad assumption at scale.
Verify the site after cleanup
Run the same checks you recorded before the change, then inspect logs and scheduled jobs for at least one normal operating cycle.
- Log in and log out with administrator and ordinary user accounts.
- Open the editor, publish a test post, update an existing page and confirm revisions behave as intended.
- Submit every important form and verify email delivery or the site’s mail queue.
- Post, approve and moderate a test comment if comments are enabled.
- Confirm scheduled publishing, backups, cron tasks and any queue-processing plugin run successfully.
- Complete a test ecommerce flow—cart, checkout, payment test mode, order email and order administration—if the site sells anything.
- Search for posts, products and users; check filters, pagination and taxonomy archives.
- Open features that use custom tables, such as analytics, memberships, bookings or subscriptions.
- Compare table sizes, autoload totals, error logs and representative query behavior with your baseline.
Keep the database and file backups until these checks pass and the site has operated normally. If a feature fails, stop further cleanup, restore the matching database and files, and then isolate the specific deletion on staging.
Common failure modes and recovery
The database is still large
Check which tables dominate the new report. Large media-related metadata, ecommerce order tables, logs, analytics records, indexes or legitimate content may account for most storage. Repeating transient deletion will not solve a table that is large for another reason.
Autoloaded data keeps growing
Compare the largest option names over time. A plugin may be writing a cache, log or queue into wp_options. Contact the plugin maintainer or use its retention settings rather than deleting values that active code expects.
A plugin stopped working
Restore the backup if the cause is unclear. If the failure began after changing an autoload flag, restore that option first and test on staging. If a custom table was removed, restore the table and its related options together; reinstalling the plugin may not recreate historical data.
Optimization takes too long or locks traffic
Stop treating optimization as an emergency cure. Ask the host about table size, engine behavior and a maintenance window, and run the operation on staging first. Record-level cleanup and table optimization can be scheduled separately when the production workload is lower.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchRestoration is incomplete
A database-only restore cannot bring back deleted uploads, plugin files or a theme. Restore the matching file backup as well, then check wp-config.php, database credentials, salts and any host-specific configuration. This is why the pre-cleanup backup must include both the database and the WordPress files.
A repeatable maintenance policy
After the first successful cleanup, document the decisions that made it safe: revision retention, comment-retention rules, transient handling, plugin uninstall policy, autoload threshold review and backup retention. Review measurements on a schedule that fits the site’s publishing volume instead of running destructive cleanup every day.
For a small site, a periodic manual review on staging may be enough. For a busy site, automate only the non-destructive measurements first, alert on unusual growth, and require a human decision before deleting plugin-owned data or changing autoload flags. Keep an off-site backup and periodically perform a test restore so the recovery process remains usable when it is actually needed.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

