Skip to content

SELECT

SELECT * | <cols> FROM <table>
  [WHERE entity = '...' [AND ts ...]]
  [LATEST ON ts PARTITION BY entity]
  [ORDER BY ts [ASC|DESC]]
  [LIMIT <n>];

Range reads (immutable tables)

Rows are reconstructed: one row per timestamp where any selected channel has a real sample; other cells filled per channel policy (forward-fill). Selecting fewer channels therefore returns fewer rows — the timestamp union is over what you asked for.

SELECT entity, ts, speed, event FROM telemetry
  WHERE entity = 'veh-1' AND ts BETWEEN 1700000000000 AND 1700086400000;

Without an entity filter the scan covers every entity, ordered by ts across all of them.

Device shadow

SELECT * FROM telemetry LATEST ON ts PARTITION BY entity [WHERE entity = '...'];

One row per entity: each channel at its stream tail, ts = the newest sample among the selected channels. Fully deleted entities do not appear.

Mutable tables

A plain SELECT on a MUTABLE table always resolves to the current version per entity (same shape as LATEST ON). Version history is not a query surface — it is merge fuel.

Ordering & limits

ORDER BY ts (only ts) with ASC/DESC, then LIMIT n:

SELECT ts, speed FROM telemetry WHERE entity = 'veh-1' ORDER BY ts DESC LIMIT 100;