Implementing Data Archiving Strategies

1. Identifying Archive Candidates

SignalDetail
AgeRows older than X (orders > 7 years)
Access frequencyUntouched in 90 days
StatusClosed/cancelled/terminated
RegulationHold for compliance, archive after
SizeLargest tables yield biggest wins

2. Designing Archive Schemas

PatternDetail
Parallel archive tableSame shape, slower storage
Compressed columnarParquet/ORC on object storage
Wide JSON blobSingle denormalized row
Drop indexesArchive is rarely queried
Partition by dateFast drop of expired data

3. Implementing Tiered Storage

TierLatencyStorage
HotmsNVMe SSD, primary DB
Warmsub-secondSATA SSD, slower DB / read replicas
ColdsecondsHDD, S3 Standard
Frozenminutes-hoursS3 Glacier, tape

4. Creating Archive Policies

Policy ElementExample
Triggerrow.status='closed' AND closed_at < NOW() - INTERVAL '2 years'
ScheduleNightly batch, low-traffic window
Batch size10k rows, throttled
Destinationarchive schema or external store
VerificationRow count + checksum before delete

5. Managing Archive Retention Periods

RegulationTypical Retention
SOX (US financial)7 years
HIPAA (US health)6 years
GDPR (EU)Necessary period only; right-to-erasure
PCI-DSS1 year (logs), card data minimized
Custom businessDefine in data governance policy

6. Implementing Data Purging Procedures

ApproachDetail
Soft delete firstMark deleted_at, then purge later
Batched DELETELIMIT-based loops to avoid bloat
TRUNCATE partitionO(1) when using time partitions
Tombstone tablesTrack what was deleted for audit
VACUUM afterReclaim space (PG)

7. Querying Archived Data

MechanismDetail
UNION viewSELECT FROM hot UNION ALL archive
Foreign data wrapperPG FDW to read S3/Parquet
External query engineAthena, BigQuery, Trino
Rehydrate on demandCopy back to hot for active use

8. Handling Compliance Requirements

RequirementMechanism
Right to erasure (GDPR)Purge from primary + archive + backups
Legal holdSuspend deletions for specific records
Immutability (SEC 17a-4)WORM storage (S3 Object Lock)
Audit trailLog every archive/purge event
EncryptionKMS keys; per-tenant where required

9. Implementing Archive Compression

MethodDetail
Columnar (Parquet/ORC)5–10× compression on analytical data
zstd / gzip / lz4General-purpose dump compression
DB-native page compressionInnoDB PAGE_COMPRESSED, Oracle Hybrid Columnar
DedupZFS / fs-level dedup for blobs

10. Testing Archive Restore Procedures

TestDetail
Spot restorePull random record from cold tier
Full bucket restoreTime to recover by date range
Schema compatibilityRestore old data into current schema
DocumentationRunbook + tooling versions