SQL Reference
KalamDB is SQL-first with additional commands for realtime subscriptions, storage lifecycle, topics, and cluster operations.
This chapter is organized by command category so you can jump directly to implementation details.
SQL Categories
| Category | Description |
|---|---|
| Namespaces | create/drop/select namespace context |
| Table DDL | create/alter/drop tables and views |
| Data Manipulation | INSERT, UPDATE, DELETE, SELECT |
| Query Data (SELECT & JOIN) | query patterns, joins, CTEs, and DataFusion-compatible SELECT usage |
| Subscriptions | SUBSCRIBE TO, KILL LIVE QUERY |
| User Management | create/alter/drop users and roles |
| Storage | storage backends, flush, compact, manifests |
| Storage ID Usage | table-to-storage mapping patterns |
| Cluster | raft and node operations |
| Backup & Restore | namespace backup/recovery commands |
| Impersonation | EXECUTE AS USER wrapper syntax |
| Functions | KalamDB built-ins plus DataFusion SQL function support |
Statement Separator
SELECT 1;
SELECT 2;Quick Example
CREATE NAMESPACE IF NOT EXISTS chat;
CREATE TABLE chat.messages (
id BIGINT PRIMARY KEY DEFAULT SNOWFLAKE_ID(),
sender TEXT NOT NULL,
content TEXT NOT NULL,
created_at TIMESTAMP DEFAULT NOW()
) WITH (TYPE = 'USER', FLUSH_POLICY = 'rows:1000');
INSERT INTO chat.messages (sender, content)
VALUES ('alice', 'Hello world!');
SELECT * FROM chat.messages ORDER BY created_at DESC LIMIT 20;Last updated on