WAL — log before write. Write-Behind — write to cache, sync later.
Write-Ahead Logging (WAL):
WAL:
1. Write to log file
2. Apply changes to database
3. If crash → replay log
(Log first, then apply)
Write-Behind Caching:
Write-Behind:
1. Write to cache (fast)
2. Async write to DB
3. If crash → possible data loss
(Cache first, sync later)
Key differences: