π¬π§ English Β· πΉπ· TΓΌrkΓ§e
A safe, non-blocking background cleanup tool that purges expired transients and orphaned store data in small batches without locking database tables or interrupting active shoppers.
Developed and maintained by Harun Sekmen β E-Commerce Systems Engineer & WooCommerce Developer.
βοΈ Discuss Database Optimization Β· πΌ Upwork Profile Β· π Main GitHub Profile
Store administrators can view the count of safely cleaned rows, monitor pending expired transients, adjust batch chunk sizes, or trigger on-demand maintenance:
As a WooCommerce store grows and handles thousands of orders or frequent inventory updates, it accumulates massive amounts of temporary data:
- Expired Transients: Stale session fragments, cached calculations, and expired API tokens cluttering the
wp_optionstable. - Orphaned Item Records: Lingering data rows left behind in order item and metadata tables after past order modifications.
- The Table Lock Trap: When store owners run standard database cleanup plugins on a busy store, those tools often execute a single massive deletion query (e.g.,
DELETE FROM wp_options WHERE...). This can lock the entire database table for several seconds. If a customer attempts to place an order at that exact moment, their checkout crashes with a database lock error.
WooCommerce Deadlock-Free Database Vacuum solves this by cleaning records in small, indexed batches (default: 500 rows at a time) managed quietly in the background via WooCommerce Action Scheduler. It introduces a brief pause between batches so active customer checkouts always maintain top database priority.
- Chunked Batch Deletions: Deletes records in manageable micro-batches using indexed primary key lookups instead of locking entire tables.
- Paced Micro-Pauses: Includes a brief pause between chunks to ensure live customer checkouts and cart updates never compete for table locks.
- Asynchronous Background Runs: Automatically schedules periodic maintenance through Action Scheduler during off-peak hours.
- High-Performance Order Storage (HPOS) Ready: Built with native support for WooCommerce custom order tables and modern schemas.
- Clear Admin Visibility: See exactly how many expired records were safely cleared without needing manual phpMyAdmin intervention.
Managing an established WooCommerce store with a large database or slow backend queries?
- Database Health Audits: Identify bloated tables, missing indexes, and un-optimized query patterns.
- HPOS Migration & Cleanups: Safe migration from legacy
wp_poststables to High-Performance Order Storage tables. - Scheduled Automated Maintenance: Non-blocking background routines to keep transient and session bloat under control.
- Performance Tuning: MySQL/MariaDB query optimization and object cache configuration (Redis/Memcached).
π© Get in touch: Contact me at [email protected] or connect on Upwork.
-
Clone into plugins directory:
git clone https://github.com/harunsekmen/woo-deadlock-vacuum.git wp-content/plugins/woo-deadlock-vacuum
-
Activate via WP-CLI:
wp plugin activate woo-deadlock-vacuum
-
Review maintenance status: Open WooCommerce > DB Vacuum in WordPress Admin to review pending transients and trigger a test cleanup.
This open-source project is licensed under the GNU General Public License v3.0.
