Skip to main content

Module distinct

Module distinct 

Source
Expand description

Byte-bounded streaming physical DISTINCT operator.

The operator keeps exact encoded keys in memory until their combined byte size reaches work_mem. It then migrates every key to a temporary, bucketed on-disk set. Disk probes compare the complete encoded key, so a hash collision can never turn a new row into a duplicate. Output remains streaming and preserves the first row for every key in child order.

Structs§

CanonicalRowHashSet
Collision-safe in-memory set for positional SQL rows.
Distinct
Stable SQL duplicate elimination.
ExactRowSet
Exact, byte-bounded row-key set that can outlive one physical operator.

Constants§

DEFAULT_DISTINCT_WORK_MEM_BYTES
Default used by compatibility constructors. Engine callers should pass the current session’s work_mem through Distinct::all_with_work_mem or Distinct::on_with_work_mem.

Functions§

canonical_row_key
Encode positional SQL values in the exact equality domain used by DISTINCT and spill-backed row-key state. Callers that need an external exact index can persist this representation without relying on Value’s serialization format.
hash_canonical_row
Hash a borrowed positional SQL row in its canonical equality domain.
try_pack_compact_text_pair
Pack exactly two text-or-NULL values of at most three bytes each into an injective integer key. None selects the general collision-safe encoder for every other row.