New 24/7 monitoring and daily cloud backups now included in every Shield Pro plan.

Database

How to reduce WordPress database size

A bloated database slows backups, migrations, and admin searches. wp_options and wp_postmeta grow quietly from expired transients, old Action Scheduler rows, and revision history. This tutorial trims fat without deleting orders or customers.

Time: 30-50 minutes Level: Intermediate

What this problem looks like

Database size rarely affects front-end speed until tables hit millions of rows. It always affects backup windows, staging sync, and admin queries on meta-heavy plugins.

Never truncate wp_posts for shops. Order and subscription data lives there. Focus on transients, logs, sessions, and revisions first.

Full database optimisation plugins can delete data plugins still need. Read each checkbox. Exclude WooCommerce session and order tables from aggressive plugins.

Find what consumes space

In phpMyAdmin, sort tables by size. Common culprits: wp_postmeta, wp_options, wp_actionscheduler_actions, wp_actionscheduler_logs, wp_comments.

bash
wp db size --tables
wp transient list --search= --format=count

Safe cleanup targets

  • Post revisions beyond your retention policy.
  • Trashed posts and spam comments.
  • Expired transients in wp_options.
  • Completed Action Scheduler actions older than 30 days.
  • Large wc-logs files under uploads.

WooCommerce-specific caution

Do not delete orders, subscriptions, or customer download permissions. WooCommerce → Status → Tools offers Clear expired transients and Clear customer sessions for safer session cleanup.

Remove orphaned post meta carefully

Plugins leave orphan meta when posts delete improperly. Advanced DB Cleaner can remove orphans after backup. Run on staging first and verify shop checkout after cleanup.

Schedule ongoing maintenance

Limit revisions with wp-config constant WP_POST_REVISIONS. Schedule weekly transient cleanup on busy sites. Monitor Action Scheduler failed actions separately from size.

php
define( 'WP_POST_REVISIONS', 5 );
define( 'EMPTY_TRASH_DAYS', 7 );

When to stop DIY and hire help

Tables over several gigabytes, corrupted indexes, or multisite networks need DBA-level help. BugShield shrinks WooCommerce databases and fixes slow meta queries.

FAQs

Will database cleanup speed up my site?

Moderately for admin and backups. Front-end gains are smaller unless queries were scanning huge meta tables on every page.

Is WP-Optimize safe for WooCommerce?

Use WooCommerce-aware settings. Do not enable every aggressive option without reading descriptions.

How big is too big for WordPress database?

No fixed limit. Problems appear when backups exceed hosting limits or admin queries timeout, often above 1 to 2 GB on modest hosting.

Can I delete wp_options transients manually?

Expired transients yes. Active transients break features until regenerated. Use wp transient delete --expired when possible.

Rather someone else fixed it?

Request a fix at a confirmed price. Named UK developer, secure Vault, direct chat.

Request a Fix