Skip to main content

SQL Overview

xcon-db executes a lean subset of SQL over its three table families — timeseries, rows and kv. Standard SQL is accepted at the interface; anything outside the subset gets a clean error instead of a slow surprise. There is no general relational optimizer and there are no joins — leanness lives in what the engine refuses to execute.

Statements

StatementPurpose
CREATE TABLEDeclare a timeseries table, its channels and policies
CREATE ROWS TABLEDeclare a current-state rows table (engine-generated id)
CREATE KV TABLEDeclare a key→value table (SET/GET/DEL over SQL, optional TTL)
ALTER TABLEAdd, tune, rename or drop columns (no type changes)
DROP TABLERemove a table and its data
TRUNCATE TABLEEmpty a table's data, keep its declaration (and snapshots)
INSERTAppend observations; on rows tables, mint a new row; on kv tables, SET (upsert)
UPDATEPartial write to a rows-table row (AND x_rev = N = optimistic push)
SELECTRange scans, LATEST ON, ordering, limits; current rows on rows tables; GET/scan on kv
SAMPLE BYDownsampling with FILL(PREV|NULL|LINEAR)
DELETETombstone an entity (timeseries, mutable); soft-delete a row (rows); DEL a key (kv)
PROFILE <statement>Run the statement with stage spans on, answer with the span tree
CHECKPOINTSeal for backup
SHOW TABLES/COLUMNSThe schema, honestly
SHOW LOGS/SESSIONSThe operator's window
SHOW REVISIONS / RECORD REVISIONThe migration journal
BEGIN/COMMIT/ABORT MIGRATIONAtomic migration — all or nothing
SNAPSHOT / RESTORE / SHOW SNAPSHOTSCopy-free rows-table snapshots (rows)
VACUUMPurge a rows table's tombstone traces, raise its sync horizon
CREATE/DROP DATABASE, … USERNode management (admin)
ALTER DATABASE SET DURABILITY, SHOW DURABILITYStrict (default) or relaxed write durability

Literals & durations

  • strings: single quotes, '' escapes — 'door ''open'''
  • numbers: 42, -3.5
  • NULL, true/false (booleans are just 1/0 — the type system is f64+string; BOOL and INT are catalog views over f64)
  • durations: <number> [ms|s|m|h|d]60 s, 90 d, bare numbers are milliseconds
  • -- starts a comment

WHERE

On a timeseries table, exactly two predicates exist, combined with AND (a rows table filters by xid = '...' and/or one column comparison= on any column, >/>=/</<= on a numeric one; a kv table filters by key = '...' only):

  • entity = '<string>'
  • ts comparisons: >=, >, <=, <, =, BETWEEN a AND b (ts is Unix milliseconds)

That is not a placeholder for a future expression engine; value predicates belong in your code or your dashboard tool.