Skip to content

INSERT

INSERT INTO <table> (entity, ts, <channels...>) VALUES (...), (...), ...;
  • entity (string) and ts (number, Unix milliseconds) are required columns
  • any subset of channels may appear — a fragment writes only what it carries
  • NULL in a value list means "this channel did not arrive" (nothing is written)
  • value types must match the channel declaration (number → f64, string → string)
-- full fragment
INSERT INTO telemetry (entity, ts, speed, status) VALUES
  ('veh-1', 1700000000000, 52.5, 'moving'),
  ('veh-2', 1700000001000, 12.0, 'idle');

-- partial fragment: only the event channel arrived
INSERT INTO telemetry (entity, ts, event) VALUES ('veh-1', 1700000030000, 'brake');

Updating mutable tables

There is no UPDATE statement: on a MUTABLE table, inserting the same entity with a newer ts is the update. Reads resolve to the newest version; the merge worker discards the rest.

INSERT INTO devices (entity, ts, name) VALUES ('d1', 1700000000000, 'old-name');
INSERT INTO devices (entity, ts, name) VALUES ('d1', 1700000060000, 'new-name');
SELECT name FROM devices WHERE entity = 'd1';   -- 'new-name'