The host's storage alert arrives on Monday. A database report shows a large table called postmeta, a queue with thousands of rows and a log that seems to grow every night. A cleaning plugin offers to remove “unused data” with one click. The sensible first question is which of those records someone would miss tomorrow.

WordPress stores pages, settings and relationships in its database. A shop may also store orders, stock reservations, customer details, payment references and the work that still needs to run. These records can look remarkably similar in a table-size report. The safest useful outcome may be a shorter log retention period, a fix to a repeating error or simply more capacity for legitimate growth.

Establish what the storage alert actually measures

Ask for the unit and the boundary. A host's account quota may cover uploads, local backups, email, cache files and logs as well as the database. A database export has its own size, which depends on how it was created and compressed. A report from the database server may include data and indexes. Record the measurement method before comparing today's figure with a screenshot taken last year.

If the Media Library has grown by 8 GB and the database is stable at 350 MB, pruning post revisions will barely affect the storage alert. Uploaded image files normally sit in the uploads directory or object storage. The database holds attachment records and metadata about them. Deleting an “unused” attachment to shrink the database can break an image used in theme settings, a newsletter or another website. Treat file storage as a separate investigation.

With host-approved shell access and WP-CLI installed, run this read-only report in the intended installation:

wp db size --tables --all-tables-with-prefix --human-readable

The prefix option helps include matching plugin tables outside the standard WordPress table list. Confirm the selected environment and site, especially on Multisite or a shared database. A prefix match is a starting point for attribution. A leftover table from a previous migration could have a different prefix, or several sites may share infrastructure. Ask the host to help map anything unexpected. When shell access is unavailable, request an equivalent table-size report from the host's database tools. WP-CLI database size reference.

Compare growth, then identify who writes the records

Take a second snapshot with the same method after a representative operating interval. Keep the exact date, time zone and period. A reasonably large order table that grows at the rate of normal trading may need a completely different response to a modest log table that triples in a week. Compare order volume, failed integration jobs, recent migrations and changes to logging over the same dates.

Consider this illustrative week of measurements. The names here describe table groups, and the numbers are examples for learning.

Group Monday Following Monday Decision to investigate
WooCommerce order-related tables 850 MB 866 MB Compare with ordinary order volume and the shop's retention rules.
A shipping integration's diagnostic log 120 MB 410 MB Ask why one integration wrote 290 MB in a week.
Scheduled action tables, including history 210 MB 214 MB Check pending, failed and completed work separately.
Core posts and post metadata 440 MB 442 MB Little growth in this window. Leave until there is a specific question.

Here, deleting last month's log might temporarily delay the next quota alert. Finding that the shipping service is rejecting the same scheduled request every five minutes explains what to fix. Ask the integration owner about the error and normal retention. Preserve the minimum diagnostic evidence they need, with personal details removed from shared tickets. Change the supported setting or integration behaviour in a test environment before scheduling any historical clean-up.

Assign an owner to each candidate. A prefix such as wc_ gives you a clue but cannot tell you whether a record is dispensable. Check active and recently removed plugin documentation, configuration and recent release notes. If nobody can say what a table contains, who reads it and how it is rebuilt, leave it alone. An inactive plugin may be part-way through a migration, awaiting an export or due to be reactivated for the next seasonal sale.

Separate business data, recoverable history and temporary data

Order lines, refunds, addresses, tax history and fulfilment references have a business purpose beyond the WordPress screen on which they appear. The accounts team, payment provider and warehouse may all rely on relationships between those records. Ask the owner of the records to define the retention requirement. Use the store's supported retention or anonymisation process where appropriate. A generic cleaner cannot decide what the business needs to keep.

WooCommerce's High-Performance Order Storage, or HPOS, can store orders in dedicated tables. Other stores may use the traditional WordPress posts and post metadata. Compatibility mode can keep data synchronised between storage systems. Determine which store is authoritative and whether synchronisation is pending from the WooCommerce configuration. A second representation, a placeholder or an apparently empty post can all have a purpose. Do not remove one side of a migration or infer that the shop has no orders because a particular table looks quiet. WooCommerce HPOS documentation.

A revision is the ability to recover earlier editorial work. Spam and trashed items may still be relevant to a moderation or recovery workflow. Completed job history can be useful evidence when a customer asks why a refund notification arrived late. Establish who uses each category and how far back they look. Retaining a measured amount of history can be cheap compared with the time spent reconstructing a single incident.

Transients are temporary cached values. Default installations can store them in the database, while a persistent object cache can store them elsewhere. WordPress and plugins must be able to regenerate transient values. Regeneration may still involve expensive work or remote API calls. On a busy site, emptying every cache at once can create needless load. Where expired database transients have been identified as the actual issue, use the narrow, supported expired-only operation on staging first. WP-CLI documents the options and cache behaviour. Transient commands and expired transient deletion.

Rehearse recovery before touching production records

Make a fresh backup that includes the relevant tables and the matching versions of plugins, themes and uploads. Check how the backup product treats custom plugin tables. A WordPress XML content export alone is insufficient for a WooCommerce store. Restore the backup into an isolated location and prove it opens. A completed backup job records an attempt to take a copy. Opening a known order, page and relevant setting in the restored copy shows what that copy can recover. WooCommerce backup guidance and how to test a website restore.

Protect real customer data in the copy. Keep access private, disable live payment and outgoing fulfilment or email, and use an approved test destination. Do this before loading the restored application if startup jobs could fire. Record the time of the backup and the point at which current trading moved beyond it. That gap is central to deciding whether a full restore would be acceptable later.

Write down the test records in a way a colleague can repeat without exposing private details outside the store. Choose an order with several line items, a refunded or partially fulfilled order if available, a product with variations, a page with revisions and one record read by the plugin whose data you intend to prune. Select a pending job if its queue is in scope. In the isolated copy, check each record through the normal application screen or supported integration, not only by looking at a raw table count.

Design a clean-up small enough to explain

Choose a single class of records and a date boundary. For example, “shipping connector diagnostic entries older than the approved 30-day support window, excluding the incident period still under review” describes a testable job. “Old plugin data” does not. Work out whether the vendor's tool accepts that boundary, previews the affected set and removes data in batches. If the tool can only empty the whole table, take that limitation back to the owner. A supported retention setting may satisfy the requirement on future runs.

Use the store's logging configuration to determine whether logs live in files or in the database before pursuing a table clean-up. WooCommerce supports logging storage options, and individual extensions can have their own logger and retention behaviour. Changing the WooCommerce core logger will not necessarily change a shipping plugin's independent log. Look for one fresh entry in the expected destination after a controlled test. WooCommerce logging documentation.

Run the scoped operation on the restored copy and measure the elapsed time, number of rows or log entries affected, and oldest retained date. Verify entries immediately either side of the cutoff. If “older than 30 days” is evaluated in UTC and the support team works in Sydney time, check how the interface presents the boundary. Use an unambiguous timestamp in the job record. Emptying a fixed period repeatedly should leave the retained records intact. If the operation removes a different class on each run without explanation, pause and clarify its behaviour.

Review the pending queue separately. A long list of failed jobs can indicate a broken integration that needs to be fixed, and deleting pending actions can remove work a customer is waiting for. Do not replay a failed payment, fulfilment or notification action solely to see whether it disappears from a list. Check the receiving system and the plugin's retry rules before altering the queue. The guide to WordPress scheduled tasks distinguishes trigger, worker and job-level evidence.

Carry the tested scope into the live window

Agree who is watching the operation, which metrics signal trouble and who can pause it. Large deletions or table maintenance can compete with live requests even when the records themselves are disposable. Ask the host about available space and a suitable window if a table is large. Keep a record of the exact tool, version, filter, environment, expected record count and backup reference. These details matter if support later has to explain why two reports disagree.

Immediately before the run, repeat the size and target-count measurements. A staging copy from Thursday will not contain Friday's orders or incidents. If production now includes a new support case within the proposed scope, adjust the boundary and retest. Apply the smallest supported batch first. Check public pages, admin response and recent order status, then continue only if the results match the rehearsal. Record any provider warnings or database errors.

Afterwards, confirm a recent log entry remains visible, an old eligible entry has gone, and the plugin can still write a new controlled entry. Check representative orders, a refund record, product stock and the action queue against the pre-run references. If the shop uses scheduled exports or reporting, check their next ordinary run or a safe read-only preview. An unchanged checkout screen does not prove the next finance export will include the expected records.

Decide whether the storage problem is actually solved

The database engine may reuse space released inside tables without immediately returning an equivalent number of bytes to the host. Some quota dashboards also update on a delayed schedule. Ask the host what the measurement includes before deciding the deletion failed. Do not run a table rebuild solely to make a dashboard figure fall. It can require additional working space and affect the live service. A smaller weekly growth rate or a shorter, successfully restored backup can be a meaningful operational improvement even if the displayed allocation barely moves initially.

Repeat the original measurements after a normal trading interval. In the example, a week of stable diagnostic storage after fixing the failed shipping call is stronger evidence than a dramatic drop followed by another 290 MB rise. Keep the owner, retained history, growth trend and next review date in the maintenance record. If growth instead tracks a healthy increase in orders, include that in capacity planning rather than squeezing customer records to meet an arbitrary number.

If something important is missing, stop further clean-up and preserve the current live state. Restore the pre-clean-up copy into an isolated environment and identify precisely which records and dependencies need recovery. On a trading site, replacing the whole live database could erase orders placed since the backup. Coordinate any selective recovery with the host, extension vendor and person responsible for order reconciliation. Confirm what the payment and fulfilment systems already processed before resending anything. Recovery is complete when the affected workflow works and newer orders still reconcile.