SQL Reference (Website Summary)
This page summarizes the SQL surface used on the website. For the full engine reference, see docs/sql.md in the source repository.
The time column
- Every table must include a column named
time. - Type:
BIGINTorTIMESTAMP(various precisions / time zones). - Always non-null.
- Used for memtable ordering and Parquet time pruning.
Common types
Numeric & Boolean
| SQL Type | Notes |
|---|---|
TINYINT / SMALLINT / INT / BIGINT | Signed integers |
TINYINT UNSIGNED … BIGINT UNSIGNED | Unsigned variants |
FLOAT / DOUBLE | Floating point |
BOOLEAN | |
DECIMAL(p,s) / NUMERIC(p,s) | Precision 1..=38; bare DECIMAL defaults to (38,10) |
Strings & Binary
| SQL Type | Notes |
|---|---|
VARCHAR / CHAR / TEXT | UTF-8 text |
BLOB / BINARY / VARBINARY / BYTES | Binary |
Date & Timestamp
| SQL Type | Notes |
|---|---|
DATE | Insert as 'YYYY-MM-DD' strings |
TIMESTAMP / TIMESTAMP(p) | Default milliseconds; INSERT uses raw integer epochs |
TIMESTAMP … WITH TIME ZONE | Stored as UTC |
Nested
| SQL Type | Notes |
|---|---|
ENUM('a','b',…) | Dictionary-backed enum |
ARRAY<T> / T[] | Lists, e.g. ARRAY<VARCHAR> |
STRUCT<field T, …> | Nested structs |
Unsupported examples: UUID, JSON, SQL Interval type.
DDL / DML highlights
CREATE TABLE metrics (
time BIGINT,
device_id VARCHAR,
value DOUBLE
);
ALTER TABLE metrics ADD COLUMN region VARCHAR;
INSERT INTO metrics (time, device_id, value)
VALUES (1718000000000, 'sensor-1', 21.5);
LOAD PARQUET '/data/import/part-000.parquet' INTO metrics;
FLUSH TABLE metrics;
FLUSH TABLES;
Timestamp inserts
For TIMESTAMP columns, INSERT VALUES expects raw integer epochs matching column precision. ISO-8601 strings are not accepted today.
Querying
DataFusion-powered SELECT with filters, aggregates, joins, and window functions (see engine / IT coverage). Prefer filtering on time for pruning.
SELECT device_id, COUNT(*) AS n, AVG(value) AS avg_v
FROM metrics
WHERE time >= 1718000000000
GROUP BY device_id;
Access path
All SQL goes through gRPC (monots CLI or Rust SDK), default http://127.0.0.1:50051 with admin / admin.
Related
- Edge-to-Cloud Sync Guide — push local tables to Kafka or Data Lakes
- Streams reference