Skip to content

Quick Start

1. Create a database and a user

Every firm (tenant) is one database — one self-contained directory.

xcon-db-time createdb -root ~/xcon-data demo
xcon-db-time useradd  -root ~/xcon-data demo secret demo   # user, password, db

2. Start the server

xcon-db-time serve -root ~/xcon-data -pg 127.0.0.1:5432 -http 127.0.0.1:9000

3. Create a table

Any PostgreSQL client works. With psql:

psql "postgres://demo:secret@127.0.0.1:5432/demo"
CREATE TABLE telemetry (
  speed DOUBLE FILL HOLD STALENESS 60 s,
  event TEXT   FILL NONE
) WITH (RETENTION 90 d);

entity (which device) and ts (Unix milliseconds) are implicit columns on every table.

4. Write and read

INSERT INTO telemetry (entity, ts, speed) VALUES
  ('veh-1', 1700000000000, 50),
  ('veh-1', 1700000060000, 62);

INSERT INTO telemetry (entity, ts, event) VALUES
  ('veh-1', 1700000030000, 'brake');

SELECT * FROM telemetry WHERE entity = 'veh-1';

Note what comes back: at ts = 1700000030000 the speed column reads 50 — the last observed value, carried forward because the channel was declared FILL HOLD. The event column is null everywhere except its exact timestamps, because FILL NONE refuses to invent data. This is forward-fill, the heart of the read model.

5. Or ingest over ILP / HTTP

# InfluxDB line protocol, straight from a device or Telegraf:
xcon-db-time serve -root ~/xcon-data -pg :5432 -ilp 127.0.0.1:9009 -ilp-db demo

printf 'telemetry,entity=veh-1 speed=52.5 1700000120000000000\n' \
  | nc 127.0.0.1 9009

# HTTP with basic auth:
curl -u demo:secret 'http://127.0.0.1:9000/query?q=SELECT+*+FROM+telemetry'