Table DDL
KalamDB supports three application table types: USER, SHARED, and STREAM. For the full
architecture, access matrices, storage behavior, and when to choose each type, see
/docs/server/architecture/table-types.
CREATE TABLE
Syntax
Table options are type-specific:
USER:STORAGE_ID,USE_USER_STORAGE,FLUSH_POLICY,COMPRESSIONSHARED:STORAGE_ID,ACCESS_LEVEL,FLUSH_POLICY,COMPRESSIONSTREAM:TTL_SECONDS,EVICTION_STRATEGY,MAX_STREAM_SIZE_BYTES
ACCESS_LEVEL is enforced only on SHARED tables. PUBLIC allows regular users to read but not
write; PRIVATE and RESTRICTED allow service, dba, and system roles; DBA allows only dba and
system roles. The canonical shared-table access matrix is maintained at
/docs/server/architecture/table-types.
For storage-specific options such as STORAGE_ID and USE_USER_STORAGE, see
/docs/server/sql-reference/storage-id-usage. For
flush behavior, see /docs/server/architecture/storage-tiers.
COMPRESSION accepts only none, snappy, and zstd, and is valid only for USER and SHARED
tables. It controls the Apache Parquet codec used when table data is flushed or compacted into
cold-storage segments. none writes uncompressed Parquet pages, snappy is the default and
optimizes for low CPU overhead, and zstd uses Zstandard level 1 for better compression density with
modest extra CPU. This option is not WebSocket gzip and does not change RocksDB hot-tier
compression. STREAM tables use hot stream log storage and do not accept table Parquet compression.
Examples
User table (per-user isolated):
Shared table (global access):
Stream table (ephemeral with TTL):
ALTER TABLE
SET TBLPROPERTIES supports the same type-specific persisted options as CREATE TABLE.
Use FLUSH_POLICY = NULL to clear a user/shared flush policy.
Examples:
Vector index example
After the index exists, rank nearest rows with:
DROP TABLE
CREATE VIEW
Example: