WooCommerce database too large: which tables grow and how to shrink them
A WooCommerce database grows in five places, and only two of them are orders. Check the table sizes before cleaning anything: the biggest table is usually not the one you expect.
Measure first
phpMyAdmin → your database → sort by Size. Or with WP-CLI:
wp db size --tables --human-readable --order-by=size
On a store with 100,000 orders the ranking looks like this (test store, October 2026):
| Table | Rows | What it holds |
|---|---|---|
wp_woocommerce_order_itemmeta |
2.9 M | One row per attribute of every line item |
wp_postmeta |
5.6 M (legacy, or HPOS with sync) | Order fields, product fields, everything |
wp_comments |
720 K | Order notes (every status change is a note) |
wp_wc_orders_meta |
800 K | Order meta under HPOS |
wp_woocommerce_order_items |
363 K | Line items |
Tables that balloon on some stores and not others:
wp_actionscheduler_logs/_actions: WooCommerce's background queue. Failed actions pile up for years. Hundreds of thousands of rows is common.wp_options: expired transients and autoloaded options. Small in rows, huge in effect: autoloaded options are read on every page load.wp_woocommerce_sessions: abandoned carts. Should be cleaned by cron; isn't when cron is broken.wp_wc_admin_notes/_note_actions: admin inbox notes.
Clean in this order
- Transients and sessions. WooCommerce → Status → Tools: "Clear transients", "Clear customer sessions" (logs customers out of carts; do it at a quiet hour). Safe.
- Action Scheduler. WooCommerce → Status → Scheduled Actions: delete Failed and Complete actions older than 30 days. WooCommerce keeps complete ones for 30 days by default; the retention filter is
action_scheduler_retention_period. Safe. - Post revisions and auto-drafts (products and pages, not orders). A database plugin such as WP-Optimize handles these; untick anything that mentions orders or comments.
- Failed and pending orders older than 30 days. These are abandoned checkouts. Delete them (bulk action in the orders screen, or a cleanup plugin). Safe after a backup.
- Old completed orders. This is where the bulk of itemmeta, notes and meta lives, and it is the only step that touches sales records. Archive them rather than delete: OrderArc moves orders older than N months, with their items, meta and notes, into archive tables in the same database, verified row by row, and keeps them restorable. The live tables shrink; the database file does not, until you run the next step.
- Optimize tables.
wp db optimizeor phpMyAdmin → Optimize. This is what returns disk space after rows are removed. InnoDB withinnodb_file_per_table(the default on modern hosts) reclaims space per table.
OrderArc – Order Archive for WooCommerce is free on WordPress.org. It archives in the background, in batches that are verified by count and checksum before the live rows are removed, and keeps WooCommerce Analytics untouched.
What not to do
- Never delete rows from
wp_postmetaorwp_wc_orders_metaby SQL based on a key name you think is unused. Plugins store state there under names that look disposable. - Never truncate
wp_comments: it holds product reviews and order notes together. - Do not "delete orphaned meta" with a one-click tool on a store running HPOS with compatibility mode on: during sync, rows look orphaned for a moment.
Sources
- Action Scheduler documentation
- DevPress: Reducing database size in WooCommerce
- Measurements: OrderArc test store, October 2026
More guides
- WooCommerce orders page slow? Why it happens with many orders and how to fix it
- Should you delete old WooCommerce orders? Archive vs delete
- HPOS enabled but WooCommerce is still slow – what HPOS doesn't fix
- How to bulk delete old WooCommerce orders safely (and the reversible alternative)
- WooCommerce "auto archive old orders" feature request: three years later, what are your options