OrderArc › Guides

WooCommerce database too large: which tables grow and how to shrink them

Last reviewed 8 November 2026 · by Nicolás Alejandro Salinas

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:

Clean in this order

  1. Transients and sessions. WooCommerce → Status → Tools: "Clear transients", "Clear customer sessions" (logs customers out of carts; do it at a quiet hour). Safe.
  2. 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.
  3. 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.
  4. 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.
  5. 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.
  6. Optimize tables. wp db optimize or phpMyAdmin → Optimize. This is what returns disk space after rows are removed. InnoDB with innodb_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

Sources

More guides