Republic Day
     Credit Boost

Add $50+ and Get

Validity: 19 Jan - 26 Jan, 2026

How to Reduce WordPress Database Size: Try These 8 Methods 

|
Background Gradient

A bloated WordPress database can quietly slow down your entire site. Every time a visitor loads a page, WordPress has to pull data from the database. The bigger and messier it is, the longer that process takes. Over time, things like post revisions, spam comments, and leftover plugin data start piling up. 

For agencies managing multiple sites, this turns into a recurring headache that affects performance, backups, and client satisfaction. The good news is that you don’t need extra plugins to fix it. In this guide, we’ll go through 10 practical WordPress database size reduction methods that are safe, easy to test, and perfect for developers who want clean, high-performing sites.

Understand What’s Eating Up Your Database

Before you start cleaning your WordPress database, it’s essential to understand which tables are bloated. Not all tables grow equally. Some plugins generate excessive metadata or transients, while others leave behind unused tables even after deletion. Knowing the size and purpose of each table gives you clarity and helps you avoid deleting anything important.

Use phpMyAdmin to View Table Sizes

Those who are not using managed WordPress hosting have to log in to their hosting panel and open phpMyAdmin. Select your WordPress database and scroll down to view the list of tables. 

You’ll see a “Size” column next to each one. Look for unusually large tables like wp_options, wp_postmeta, or wp_commentmeta. These are usually the culprits behind database bloat.

Sorting tables by size gives you a clear idea of what needs attention. For example, a wp_options table bloated with transients can slow down your admin dashboard significantly.

InstaWP users can simply use the Database Editor tool, which grants them direct access to your website’s database. 

how to reduce WordPress database size

The Performance Scanner automatically flags slow-performing plugins and bloated database components. You can view insights directly from your site dashboard without running manual queries. This is especially useful for agencies managing multiple sites and needing quick diagnostics across environments.

Use WP-CLI to Check Database Size (for Developers)

For a command-line approach, WP-CLI offers a simple way to inspect the database size. 

how to reduce WordPress database size

Run:

wp db size –tables

This command shows the size of each table individually. It’s a lightweight method ideal for headless WordPress setups or script-based maintenance.

Understanding what’s taking up space helps you plan a targeted cleanup without relying on plugins or guesswork. It’s the first step every WordPress developer should take before making changes to the database.

8 Best WordPress Database Size Reduction Methods

Reducing your WordPress database size is one of the most effective ways to boost site performance without touching front-end code. A leaner database means faster queries, quicker admin panel loads, and smaller backups.

Let’s begin with the best WordPress database size reduction methods. 

#1: Clean Up Old Post Revisions

One of the most common causes of WordPress database bloat is post revisions. Every time you update a post or page, WordPress saves a revision in the wp_posts table. 

how to reduce WordPress database size

On content-heavy sites, especially blogs or WooCommerce stores, this can result in thousands of unnecessary entries that inflate your database size.

Cleaning these up is one of the fastest and safest WordPress database size reduction methods.

Method 1: Delete Revisions Using SQL

You can manually remove all revisions by running the following query in phpMyAdmin or your database tool:

DELETE FROM wp_posts WHERE post_type = ‘revision’;

Make sure to replace wp_ with your actual table prefix. This command removes all stored revisions, leaving your current posts intact.

Method 2: Disable Future Revisions

To prevent WordPress from saving future revisions, add this line to your wp-config.php file:

define(‘WP_POST_REVISIONS’, false);

how to reduce WordPress database size

This tells WordPress not to save any new revisions going forward. Alternatively, you can limit them to a specific number by setting a value (e.g., 3).

Removing revisions doesn’t affect your live content, but it dramatically reduces database size, especially if your site has hundreds of pages or posts under active development.

Here’s the next method, optimized and written with clear context, practical instructions, and seamless InstaWP integration:

#2: Delete Spam, Trash, and Unapproved Comments

WordPress stores every comment, even the ones you never approve. Over time, spam comments, trashed replies, and unapproved submissions can fill up your wp_comments and wp_commentmeta tables. For high-traffic blogs or sites with open commenting, this can lead to significant database bloat.

Cleaning these out regularly is one of the easiest WordPress database size reduction methods.

Method 1: Use the WordPress Dashboard

You can clean up comments directly from the admin panel:

  1. Go to Comments in your WordPress dashboard.
  2. Click the Spam tab → Select All → Choose Delete Permanently.
  3. Repeat the same for the Trash tab.
how to reduce WordPress database size

Also, review the Pending tab if you have old, unapproved comments that are no longer relevant.

Method 2: Use SQL for Bulk Deletion

For faster cleanup or automation, you can run these SQL commands in phpMyAdmin:

DELETE FROM wp_comments WHERE comment_approved = ‘spam’;

DELETE FROM wp_comments WHERE comment_approved = ‘trash’;

DELETE FROM wp_comments WHERE comment_approved = ‘0’;

This will remove spam, trash, and unapproved comments in bulk. As always, replace wp_ with your actual table prefix.

#3:. Remove Auto-Drafts and Trash Posts/Pages

WordPress automatically saves drafts of your content while you’re editing. These “auto-drafts” are helpful during writing, but often never get used. Similarly, when you move posts or pages to the trash, they’re not deleted permanently—they still sit in your database, occupying space.

If you haven’t emptied the trash or cleared drafts in a while, these entries can contribute significantly to WordPress database bloat.

Method 1: Clean Up from the WordPress Dashboard

Start with a manual cleanup:

  1. Go to Posts → click on the Trash tab → select all → Delete Permanently.
  2. Repeat the same under Pages.
  3. To check for drafts, filter by Status: Draft and remove any that are unnecessary.

For bulk clean up, you can also select the posts and perform bulk actions. 

how to reduce WordPress database size

This clears entries that are no longer in use but still stored in the wp_posts table.

Method 2: Use SQL to Delete Auto-Drafts

For a cleaner approach, run this SQL query in phpMyAdmin or InstaWP’s built-in DB Code Editor 

DELETE FROM wp_posts WHERE post_status = ‘auto-draft’;

how to reduce WordPress database size

This removes all auto-saved drafts that WordPress created during post edits. It’s a quick way to reduce the database size in one step.

#4: Disable Autosave (Advanced)

WordPress autosaves your content every 60 seconds while you’re editing a post or page. These autosaves are stored as separate entries in the database and can build up over time, especially on sites with many contributors or frequent updates. 

While autosave is useful during writing, it’s not always necessary on staging sites or developer environments.

For experienced users, disabling autosave can help reduce WordPress database size and limit the number of unnecessary post entries.

How to Disable Autosave in WordPress

To disable autosave, you need to modify your wp-config.php file using the Code Editor of InstaWP. 

how to reduce WordPress database size

Add the following line:

define(‘AUTOSAVE_INTERVAL’, 86400); // sets interval to 24 hours

Or, to completely disable autosave (not recommended for live blogs or editorial sites):

add_action( ‘admin_init’, function() {

  wp_deregister_script(‘autosave’);

});

This prevents WordPress from auto-saving drafts, which reduces clutter in your wp_posts table.

InstaWP doesn’t have to manually edit your config file. They can launch the Code Editor in a browser or via VS Code Extension and set a custom autosave interval or disable autosave for that environment. This is perfect for theme prototyping, plugin testing, or sites where content isn’t changing frequently.

Disabling autosave isn’t for every site, but it’s a smart move for developers building static content, landing pages, or performance-focused sites where draft history isn’t needed.

Here’s the next method, crafted to guide WordPress developers through a safe and effective cleanup process while naturally incorporating InstaWP and target keywords:

# 5: Delete Orphaned Plugin Tables

Many WordPress plugins create custom database tables during installation. But when you uninstall those plugins, the tables often remain in your database unless you remove them manually. These leftover entries are known as orphaned plugin tables, and they can significantly contribute to WordPress database bloat.

If you’ve experimented with several plugins over time, chances are your database still holds unused tables that serve no purpose. So, a better approach is to test plugins in a staging site and install them on the live site when you find them satisfactory. 

Create a staging site now. 

  1. Log in to Database Editor and select your WordPress database.
  2. Look for table names that don’t resemble standard WordPress tables (wp_posts, wp_options, etc.).
  3. If you notice tables that match previously deleted plugins (e.g., wp_revslider_settings after deleting Slider Revolution), make a note of them.

Before deleting anything, create a backup of your site

You can also use the DROP TABLE command like this:

DROP TABLE wp_oldplugin_logs;

Important: Only run this if you’re sure the plugin is no longer in use. Deleting active tables will break functionality.

#6: Optimize Database Tables (Reduce Overhead)

Over time, your WordPress database accumulates overhead—temporary storage used for updates, deletions, and modifications. This overhead doesn’t go away automatically and can make your database slower and heavier than necessary. 

Optimizing your database tables removes this excess and can significantly reduce WordPress database size.

This is one of the most overlooked yet effective WordPress database size reduction methods.

  1. Go to DB Editor and select your WordPress database.
  2. Click Check All to select every table.
  3. From the menu, choose Optimize table.
how to reduce WordPress database size
  1. InstaWP’s DB Editor will automatically defragment and compact each table, reclaiming space.

This process is safe and doesn’t delete any actual content. It simply removes redundant space from tables like wp_options, wp_postmeta, and wp_comments.

For Developers: Use WP-CLI to Automate It

Prefer working in the terminal? Run this WP-CLI command:

wp db optimize

It performs the same function across all tables and is ideal for automation scripts or cron-based maintenance tasks.

#7: Delete Expired Transients from wp_options

Transients are temporary options that WordPress and plugins use to cache data in the wp_options table. While they help speed up WordPress initially, expired transients often linger in the database long after they’re no longer needed. Over time, they clutter the wp_options table and slow down query performance.

This makes transient cleanup one of the most important WordPress database size reduction methods, especially for high-traffic or plugin-heavy websites.

How to Delete Expired Transients Using SQL

Here’s a simple SQL query you can run in the DB Editor of InstaWP to clean them up:

DELETE FROM wp_options WHERE option_name LIKE ‘%_transient_%’;

This removes both expired and orphaned transients. Make sure to replace wp_ with your actual database prefix.

This cleanup is safe to perform as WordPress will regenerate any active transients automatically when needed.

Important Notes for Plugin-Based Sites

Some plugins store large blocks of transient data (e.g., analytics, caching plugins). If your site relies heavily on them, consider testing the impact of this cleanup before applying it to production.

#8: Remove Unused Post Meta Keys (wp_postmeta)

The wp_postmeta table stores extra information related to posts, pages, and custom post types. Many plugins add custom meta fields, but when those plugins are removed, the data often stays behind. Over time, this creates unnecessary bulk in your database and slows down post queries.

For sites that have gone through multiple design or plugin changes, this cleanup is one of the most effective WordPress database size reduction methods.

Clean Up with SQL Queries

You can safely delete some known unused meta keys added by WordPress itself:

DELETE FROM wp_postmeta WHERE meta_key = ‘_edit_lock’;

DELETE FROM wp_postmeta WHERE meta_key = ‘_edit_last’;

These entries are used internally for tracking edits, but they’re not critical. Removing them doesn’t affect post content or layout.

If you want to take it further, you can identify high-volume keys that aren’t needed and similarly remove them. Always audit them first before deletion.

InstaWP makes it easy to test meta cleanup without putting live content at risk. Clone your production site to a sandbox, open the DB Editor, and run the SQL queries. After cleaning, browse your posts and custom post types to confirm everything works as expected.

If you’re unsure about a meta key, the Activity Log Viewer in InstaWP can help you track which plugins or actions are writing to that table.

Removing unused post meta reduces clutter, speeds up backend post loads, and makes future maintenance easier.

Conclusion

Cleaning up your WordPress database isn’t just about saving disk space—it directly improves performance, makes backups faster, and ensures your site runs smoothly over time. For agencies managing dozens of client sites, a bloated database can quietly become a bottleneck that affects everything from site speed to admin usability.

The good news is that you don’t need to rely on bulky optimization plugins. With the right methods—like deleting revisions, clearing transients, removing orphaned plugin data, and optimizing tables—you can keep your database lean and efficient.

If you’re unsure about running SQL commands on live sites, tools like InstaWP offer a reliable workflow. You can test all your database size reduction methods safely in a sandbox, then push only the verified improvements to production.

Ready to clean up your WordPress database with zero risk?
Start by launching a free staging sandbox on InstaWP and try these methods without touching your live site.

FAQs

1. How can I reduce WordPress database size without a plugin?

You can manually clean your database using phpMyAdmin or WP-CLI. Delete post revisions, spam comments, orphaned tables, and transients. You can also optimize tables to remove overhead. These methods are safe and effective when tested properly.

2. Is it safe to delete post revisions in WordPress?
Yes, deleting post revisions is safe and does not affect your live content. Revisions are backup drafts saved during editing. Use SQL or a sandbox to test before running the deletion on a live site.

3. Why is my WordPress database so big?
Large WordPress databases often contain post revisions, spam comments, orphaned plugin data, expired transients, and auto-drafts. These can accumulate over time if not cleaned regularly.

4. How often should I clean my WordPress database?
For most sites, cleaning your database once a month is ideal. Agencies managing high-volume or frequently updated sites may benefit from weekly cleanups using scheduled tasks or cron jobs.

5. What’s the difference between deleting and optimizing tables?
Deleting removes unused data like revisions or spam. Optimizing removes overhead, which is internal clutter from updates and deletions. Both are needed to keep your database efficient.

6. Can I use a staging site to test database changes in WordPress?
Absolutely. Using a staging site like InstaWP lets you run cleanup queries safely. You can confirm that nothing breaks before syncing those changes to your live site.


Shivanshi Srivastava

Head of Content, InstaWP

Shivanshi leads content strategy at InstaWP, overseeing blogs, newsletters, emails, and collaborations. She ensures all content aligns with business goals while leveraging her expertise in SaaS and WordPress to elevate the brand’s voice and reach. Her ultimate goal? Making complex ideas fun, fresh, and useful for readers.
Like the read? Then spread it…
Facebook
Pinterest
LinkedIn
Twitter
You might also like

Get $25 in free credits — start building today.

Create your first site and unlock all premium features today.

Request demo

Wondering how to integrate InstaWP with your current workflow? Ask us for a demo.

Contact Sales

Reach out to us to explore how InstaWP can benefit your business.