WooCommerce · Guide
How to Clean Up a Slow WooCommerce Database

Short answer
To clean up a slow WooCommerce database, measure table sizes under WooCommerce then Status, run the built-in tools for transients and sessions, clear finished Action Scheduler jobs older than 30 days in small batches, and trim autoloaded options and old revisions. Back up first, and never delete order data.
Key takeaways
- WooCommerce ships cleanup tools under WooCommerce then Status then Tools, including transient and session deletion.
- HPOS stores orders in four dedicated tables: wc_orders, wc_order_addresses, wc_order_operational_data and wc_orders_meta.
- Action Scheduler keeps completed and cancelled actions for 30 days by default, and the window can change with a filter.
- WooCommerce 10.8 and later needs PHP 8.3 or higher and a 256 MB WordPress memory limit.
- Transients without an expiry time are autoloaded, so a plugin that stores them without expiry can bloat the options table.
- Never delete order data during cleanup, since orders are legal and tax records.
What makes a WooCommerce database slow?
A WooCommerce database slows down when old orders, sessions, transients, revisions and finished background jobs pile up in tables that were built for live data.
Every order, product variation, coupon and customer note adds rows, and WooCommerce keeps much of that history by default. Product images add attachment rows, and each order can carry dozens of meta rows for totals, taxes, addresses and line items. On a store with years of sales, the orders tables can hold far more history than any report needs.
Background jobs add their own weight. WooCommerce runs its background work through Action Scheduler, and every finished job leaves a row behind for a while.
Failed jobs retry and leave more rows. Expired sessions from shoppers who never checked out sit in the sessions table until they are cleared.
None of this is a fault in WooCommerce. It is the normal result of a store that has run for years without a cleanup routine. The fix is regular, careful cleanup, not a bigger server.
How do you measure the size of the problem first?
Open WooCommerce, then Status, and read the database size, the PHP version and the memory limit before you delete anything.
The System Status page lists the size of each database table, so you can see which tables hold the most rows. Look first at the orders tables, the postmeta table, the options table and the Action Scheduler tables. A table that has grown far past the others is where your cleanup time should go.
Note the PHP version and the WordPress memory limit on the same page. WooCommerce's server recommendations list PHP 8.3 or higher and a WordPress memory limit of 256 MB or higher for WooCommerce 10.8 and later (checked November 2026). A store on PHP 7.4 will feel slow no matter how clean the database is, so fix the server numbers before you blame the tables.
The WooCommerce plugin page on WordPress.org lists the current version as 11.3.1, released 19 November 2026, with the same 256 MB memory recommendation (checked November 2026).
Write down the sizes before cleanup and again after it. That before-and-after pair is the only honest way to judge whether the cleanup helped. A guide to how to optimize the WordPress database covers the general WordPress tables that sit beside the WooCommerce ones.
What do WooCommerce's built-in tools clean up?
WooCommerce ships cleanup tools under WooCommerce, then Status, then Tools, including transient deletion, session deletion and expired transient cleanup.
The tools page lists a tool to delete all shop and product transient data, and another to delete all WordPress transient data. Transients are short-lived cached values, and the WordPress Transients API introduction explains that they are stored in the options table in a default install and deleted after their expiry time (checked November 2026). Clearing them is safe, because WooCommerce rebuilds them when the data is next needed.
Another tool deletes active customer session data, which clears cart contents for shoppers still browsing. Run that one only at a quiet hour, since it empties live carts. A separate tool updates the WooCommerce database to the latest version after a plugin update.
WooCommerce also cleans expired transients on its own every 24 hours, according to its system tools documentation (checked November 2026). If expired transients still pile up, the scheduled cleanup is not running, and that points to a WP-Cron problem rather than a database problem.
How does HPOS change database cleanup?
HPOS moves orders out of the WordPress posts tables into four dedicated order tables, so cleanup targets those tables instead of wp_posts and wp_postmeta.
Before WooCommerce 8.2, every order was a WordPress post with rows in wp_posts and wp_postmeta. HPOS stores orders in wc_orders, wc_order_addresses, wc_order_operational_data and wc_orders_meta, as listed in WooCommerce's HPOS documentation (checked November 2026). That split keeps order queries away from post queries and makes targeted backups simpler.
HPOS is enabled by default for new installations from WooCommerce 8.2 onward, and existing stores switch only when the owner chooses to (checked November 2026). Check your mode under WooCommerce, then Settings, then Advanced, then Features, before you plan cleanup, because the tables you clean depend on it.
Once HPOS is the authoritative storage and compatibility mode is off, a cleanup tool can remove old order data from the legacy posts tables. WooCommerce's system tools documentation describes a tool that runs wc hpos cleanup all and checks each order before removing its legacy copy (checked November 2026).
Run it only after a full backup, and only when no plugin still reads the legacy tables. The guide to what is HPOS in WooCommerce explains the two storage modes in detail.
How do you clear Action Scheduler backlogs safely?
Check WooCommerce, then Status, then Scheduled Actions, and clear finished actions in small batches instead of deleting the whole table.
Action Scheduler keeps completed and cancelled actions for 30 days by default, and the retention window can be changed with the action_scheduler_retention_period filter (checked November 2026). That 30-day window means a busy store can hold weeks of finished jobs, which is normal and not a fault on its own.
The problem starts when pending or past-due actions pile up, because that means jobs are not running at all. Look at the Pending and Past-due tabs first. If jobs are stuck, fix the cron setup before you delete anything, or the backlog will return within days.
To clear finished actions, use the WP-CLI command wp action-scheduler clean with a status and a date limit, for example completed, failed and cancelled actions older than 30 days.
Never run an open-ended delete across the whole table on a live store, since a large delete can lock the table and take checkout down with it. The fix guide for WooCommerce Action Scheduler past-due actions covers the stuck-queue case step by step.
How do you cut autoloaded options and transients?
Find the options that load on every page, remove the ones no plugin needs, and give transients expiry times so they clear on their own.
WordPress loads every option marked for autoload on each page load, and WooCommerce and its extensions add many of them. A single oversized autoloaded option can slow every page, including checkout. Query the options table for autoloaded rows sorted by size and look for values that belong to removed plugins.
Delete autoloaded rows only when you can name the plugin they came from and confirm that plugin is gone. If the name is unclear, set the row to not autoload instead of deleting it, then watch the site for a day. A guide to how to reduce autoloaded options in WordPress explains the check in detail.
For transients, remember that the set_transient() reference notes transients without an expiry time are autoloaded, while transients with an expiry time are not (checked November 2026). That is why a plugin that stores transients without expiry can bloat the options table fast. After clearing expired transients, watch which plugin recreates them, and update or replace that plugin if the rows return within days.
How do you clean old revisions, sessions and logs?
Delete old post revisions, spam comments, trashed items and expired shopper sessions, then clear old WooCommerce logs.
Each saved draft of a product page or post creates a revision row, and a store that edits products often can hold hundreds of revisions per product. WordPress keeps them so you can restore an older version, but revisions older than a few months are rarely restored. A database cleanup plugin can remove them in batches, and you should keep at least the latest revision of each live product.
Expired shopper sessions live in the sessions table until cleared. WooCommerce's system tools include a tool to delete session data, and clearing it at a quiet hour removes carts from shoppers who left long ago. Spam comments and trashed products add rows too, and emptying trash and spam is part of the same routine.
WooCommerce logs record gateway errors, webhook failures and import problems. Old logs can grow large on a store with a noisy gateway, so clear logs older than 30 days after you have read them.
If the same error fills the log every day, fix the gateway instead of clearing the log again. Slow order screens often come from the same backlog, and the fix guide for slow WooCommerce admin orders pages covers that symptom.
How often should you repeat database cleanup?
Run a light cleanup every month and a deeper review every three months, and always back up first.
A monthly pass covers expired transients, expired sessions, spam, trash and finished Action Scheduler actions older than the 30-day retention window (checked November 2026). That pass takes minutes and keeps the tables from growing between deeper reviews.
Every three months, review table sizes again and compare them with the numbers you wrote down at the start. Look for a table that grew fast since the last check, since fast growth points to a plugin writing rows it should not write. Check the HPOS sync state at the same time, and confirm compatibility mode is off if you finished the move to HPOS months ago.
Never automate deletion of order data. Orders are legal and tax records, and a cleanup rule that deletes old orders can destroy records you need for a refund or a dispute.
Keep order cleanup to the legacy-table tool described above, and only after a backup. For checkout speed, the guide to how to speed up WooCommerce checkout covers the front-end side that database cleanup alone cannot fix.
| Table or store | What builds up there | Safe cleanup |
|---|---|---|
wc_orders and related HPOS tables | Old orders and order meta | Keep orders; clean legacy copies only after HPOS switch |
wp_actionscheduler_actions | Finished and failed background jobs | Clear finished jobs older than 30 days, in batches |
wp_options | Expired transients and autoloaded values | Delete expired transients; review large autoloaded rows |
wp_woocommerce_sessions | Expired shopper sessions | Clear at a quiet hour |
wp_posts and wp_postmeta | Old revisions and trashed items | Delete old revisions; empty trash and spam |
| WooCommerce logs | Gateway and webhook errors | Clear logs older than 30 days after reading them |
Frequently asked questions
Is it safe to clean a WooCommerce database on a live store?
Yes, if you back up first and clear only expired transients, expired sessions and finished background jobs. Never delete order rows, and never run an open-ended delete across a whole table on a live store, since a large delete can lock the table and take checkout down.
What usually takes up the most space in a WooCommerce database?
Usually Action Scheduler jobs, old order meta and autoloaded options. Open WooCommerce then Status to see table sizes, then check Scheduled Actions for past-due jobs. A table that grew fast since your last check points to the plugin writing the rows.
Does switching to HPOS clean up the database on its own?
No. HPOS changes where orders are stored, moving them from wp_posts and wp_postmeta into four dedicated order tables. It does not delete old data, so you still need regular cleanup for sessions, transients and finished background jobs.
How often should I clean my WooCommerce database?
A light cleanup once a month covers expired transients, expired sessions, spam, trash and finished actions older than 30 days. A deeper review of table sizes every three months catches a plugin that has started writing too many rows.
How do I know if Action Scheduler is the problem?
Check WooCommerce then Status then Scheduled Actions and look at the Pending and Past-due tabs. A growing past-due list means WP-Cron is not firing on schedule, so ask your host to set up a real cron job. Clearing the backlog without fixing cron only helps for a few days.
Sources
- High-Performance Order Storage WooCommerce
- WooCommerce Server Recommendations WooCommerce
- An Introduction to the Transients API WordPress Developer Resources
- set_transient() WordPress Developer Resources
- WooCommerce System Tools Documentation WooCommerce
- WooCommerce plugin WordPress.org
- wc hpos commands WooCommerce Developer Documentation
Is your product missing, or something out of date?
Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.
Thanks — we review requests within 3 business days.


