Databases · Flashcard

What does WITHOUT OVERLAPS do in a PostgreSQL 18 PRIMARY KEY declaration?

  • AThe last column is compared for overlap rather than equality, so a key may repeat over disjoint periods
  • BThe last column is dropped from the key itself and carried in the index only as a payload for scans
  • CThe key stops enforcing uniqueness altogether and rejects a row only when two periods are identical
  • DThe key forces an ordering on that column so the index accepts periods in ascending sequence only

Why this is the answer

PRIMARY KEY (id, valid_period WITHOUT OVERLAPS) is a temporal key: the same id may appear many times as long as no two of its periods overlap, which is exactly the rule a history of states needs. The period column is a full part of the key rather than a payload, uniqueness is strengthened rather than dropped, and nothing about insert ordering is constrained.

Official docs
Study in Gnoseed →