Secondary Indexes and Versioned Table Updates

Maintain an alternate key from the same logical update and ensure stale index information cannot cause visible duplicate or missing rows.

Source
Anbloq
Language
English
Created
Updated
Chapters
2
Reading time
1 min
In this article2 chapters
  1. A table change can modify several access paths
  2. Index entries and row eligibility differ

A table change can modify several access paths

If a record’s status changes from pending to complete, an index keyed by status must reflect that change under the transaction’s visibility rules. The update can add a new index entry, remove or retire an old one, and keep a record reference. These actions need a recovery and concurrency contract so a reader’s allowed view is consistent. Maintaining each additional index increases work on updates affecting its fields.

Index entries and row eligibility differ

An engine can retain old entries for earlier snapshots or use deferred cleanup. A lookup must validate version eligibility at the appropriate layer. Enforcing uniqueness also needs concurrent decisions about new entries sharing keys. Slotted pages explain physical record references. Index-only scans discuss when index data and visibility are enough without a row read.[1][2]

References

  1. CMU 15-445/645, Introduction to Database Systems: Lectures ↩
  2. PostgreSQL Global Development Group, PostgreSQL Documentation ↩