How an Intern Released 3 Terabytes Worth of Storage Before BFCM - Shopify
Dec 14, 2018

Summary
This post details the successful deletion of over 5 billion records, freeing up 3TB of storage and improving database resilience by reducing page scans by approximately 3x. This was achieved by building a Rails background job using the `job-iteration` library for chunked deletion and an internal throttling enumerator to prevent database overload and replication lag. The job utilized cursors for efficient batch fetching and deletion, ensuring minimal impact on database performance during a critical pre-BFCM period.
More from the Data Store Selection and Usage trail
- We replaced Redis with MySQL for inventory reservations—and it scaled (2026) - Shopify
- Mitigating Deadlocks in high concurrency environments - Shopify
- Safely Adding NOT NULL Columns to Your Database Tables - Shopify
- Double Entry Transition Tables: How We Track State Changes At Shopify - Shopify
- Shopify’s Unique Data Science Hierarchy Of Needs - Shopify