SQL Reference
Version: 0.1.3 — Last Updated: February 7, 2026
KalamDB uses a SQL-first approach with extensions for real-time subscriptions, per-user isolation, and stream processing. This reference covers the complete SQL syntax.
Statement Separator
Statements are separated by semicolons:
SELECT 1;
SELECT 2;SQL Categories
| Category | Description |
|---|---|
| Namespaces | Create, drop, and manage namespaces |
| Table DDL | CREATE, ALTER, DROP tables and views |
| Data Manipulation | INSERT, UPDATE, DELETE, SELECT |
| Subscriptions | Live queries and real-time subscriptions |
| Topics & Consumers | Pub/sub topics and consumer groups |
| User Management | CREATE, ALTER, DROP users |
| Storage | Storage backends, flush, compact |
| Cluster | Cluster management and Raft operations |
| Backup & Restore | Database backup and recovery |
| Impersonation | Execute statements as another user |
| Functions | Built-in SQL functions |
Quick Example
-- Create a namespace and table
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 and query
INSERT INTO chat.messages (sender, content)
VALUES ('alice', 'Hello world!');
SELECT * FROM chat.messages ORDER BY created_at DESC;
-- Subscribe to live changes
SUBSCRIBE TO chat.messages OPTIONS (last_rows=50);Last updated on