Posts

Showing posts with the label SQL playbook

Safe Data Purge: How We Remove Old Records in Large Oracle Tables

Image
Safe Data Purge: How We Remove Old Records in Large Oracle Tables At our company, we periodically purge old data to comply with data retention regulations. Deleting millions of rows from production databases requires careful planning. Here's how we do it. Step 1: Catalog and Plan Catalog all tables and identify retention periods. Review retention schedule with legal team. Coordinate with other teams to identify downstream dependencies. Step 2: Backup Tables Always backup affected tables before deleting. This ensures quick recovery in case of unexpected issues. Step 3: Understand Table Structure Identify child tables and parent tables. Delete child tables first to avoid foreign key violations. Step 4: Batch Deletes vs Direct Deletes We tested batch deletes in our PT environment and it worked fine. However, in production: Tables have 7M+ rows and 1M+ rows to delete Batch of 20K rows...