Skip to content

CREATE TABLE

CREATE TABLE <name> (
  <channel> <TYPE> [FILL HOLD|NONE] [STALENESS <duration>|INFINITE],
  ...
) [WITH (MUTABLE | RETENTION <duration>)];

entity and ts are implicit on every table and cannot be declared.

Types

Accepted spellings Stored as
DOUBLE, FLOAT8, F64, REAL f64
TEXT, STRING, VARCHAR, SYMBOL string

Anything else (JSONB, arrays, timestamps-as-types...) is rejected: the type system is frozen at f64 + string.

Channel attributes

  • FILL HOLD — state channel; last value carries forward on reads
  • FILL NONE — event channel; never filled (default)
  • STALENESS 60 s — with HOLD: held values older than this read as null; default INFINITE

Table options

  • WITH (MUTABLE) — metadata table: last-write-wins per entity, DELETE allowed, no retention
  • WITH (RETENTION 90 d) — immutable table: day-partitions older than the window are dropped

MUTABLE and RETENTION are mutually exclusive.

Examples

CREATE TABLE telemetry (
  speed  DOUBLE FILL HOLD STALENESS 60 s,
  status TEXT   FILL HOLD,
  event  TEXT   FILL NONE
) WITH (RETENTION 90 d);

CREATE TABLE devices (name TEXT, fw DOUBLE) WITH (MUTABLE);