#[repr(C, align(8))]pub struct RowHeader {
pub xmin: u64,
pub xmax: u64,
pub flags: u8,
}Expand description
Per-row MVCC visibility header.
24 bytes after alignment (8 + 8 + 1 + 7 padding). The padding
is intentional: a power-of-two stride keeps array indexing
cheap and matches the cache-line layout PG uses for
HeapTupleHeaderData.
Fields§
§xmin: u64Version that wrote this row (= TxId of the inserting tx
at commit time). Compared against the reader’s snapshot
version to decide visibility.
Default XMIN_FROZEN = 1 on rows loaded from a pre-
v7.37.15 envelope.
xmax: u64Version that deleted / updated this row, or XMAX_ALIVE = 0
when still alive. UPDATE writes xmax on the old row +
xmin on the new one inside the same transaction.
flags: u8Bit-packed flags. See module-level constants. The most
common state (xmin frozen, xmax alive) sets only
HEAP_XMIN_FROZEN so visibility checks can short-circuit
on the flags & HEAP_XMIN_FROZEN == HEAP_XMIN_FROZEN && xmax == 0 fast path.
Implementations§
Source§impl RowHeader
impl RowHeader
Sourcepub const fn frozen() -> RowHeader
pub const fn frozen() -> RowHeader
The canonical “frozen, alive” header. Use on rows loaded from a pre-v7.37.15 envelope and on rows inserted before the writer transaction is assigned a TxId.
Sourcepub const fn alive(xmin: u64) -> RowHeader
pub const fn alive(xmin: u64) -> RowHeader
A header for a row inserted by transaction xmin, still
alive. Default for fresh INSERTs.
Sourcepub const fn is_all_visible_fast(&self) -> bool
pub const fn is_all_visible_fast(&self) -> bool
True iff this header is the all-visible fast path
(frozen + alive). The visibility-map bit is true exactly
when EVERY header in a segment satisfies this — letting
scans skip the per-row check entirely for cold segments.
Sourcepub const fn is_deleted(&self) -> bool
pub const fn is_deleted(&self) -> bool
Was this row deleted? false when xmax == XMAX_ALIVE.