Batched backfills
On This Lesson 4 topics
This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.
In this lesson
populate a new column on a huge table safely.
Planned topics
- One giant
UPDATEholds locks, creates huge WAL and bloat, and can run for hours. - Update in small batches (1 000–10 000 rows) by primary key range, each in its own transaction, with a short pause.
- Make the job resumable and idempotent (
WHERE full_name IS NULL). - Watch replication lag and load; throttle if needed.
- Run backfills from an operational job, not inside the startup migration.
Draft outline details
Demonstration
UPDATE customer SET full_name = name
WHERE id BETWEEN :from AND :to AND full_name IS NULL;Check your understanding
Why batch the update?
Show answer
Small transactions limit lock time, WAL volume, bloat, and replication lag.
Practice
Apply this lesson with the module's lab, exercises and quiz.
Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.