Track · 2:31 · Liner note
Midnight Merge
A MERGE statement combines insert, update and delete logic in one operation, applying a batch of changes to a target table by matching on a key.
At midnight, a batch of staged changes meets the table it belongs to. A merge matches on a key: rows that exist are updated, rows that do not are inserted and, if you ask, rows flagged for removal are deleted, all in a single statement.
Midnight Merge is the careful hour before the run, checking that the key is truly unique and that staging holds exactly one version of each row. Duplicates in staging become duplicates in production. Verify first, then run it.