Ticks reach the store through sharded binary COPY in bounded batches

Table of Contents

1. Summary

A few lanes write ticks, sharded by stream, so all ticks of a stream go through one lane and keep their order. Each lane holds one connection of the writer role and commits a binary COPY batch when it holds a batch of rows or when its oldest row has waited the linger, whichever comes first. The key of a point (stream, time, coordinate) is unique, and a lane writes so that a key already stored is skipped, so a redelivered tick changes nothing. The number of lanes follows the tick rate, not the number of tenants.

2. Detail

2.1. A batch is bounded both ways

Bound Value Why
Rows a few thousand One round trip carries many rows
Linger tens of milliseconds A quiet stream's tick is not held

The queue in front of a lane is bounded and keeps the newest tick of a datum, as The tick ingest pipeline: freshness first describes, so a slow store costs old ticks, never memory.

2.2. Binary COPY

A batch is one COPY in the binary format: no SQL text, no per-row statement, no text formatting of values. The lane copies into a staging table and moves the rows into the store, skipping keys already present, in the same transaction.

2.3. The live path does not wait

The lane stores; it does not deliver. A tick is republished to its subscribers on the live path before it is stored, so a store that is slow delays history, never the live tick.

2.4. The writer role

A lane writes as the writer role, which may insert points and nothing else. The points carry no tenant (A source tick is stored once and entitled when it is read), so a batch may hold the ticks of any stream.

3. Patterns used

4. See also

Emacs 29.3 (Org mode 9.6.15)