Getting Started
This walkthrough creates a managed table on local filesystem storage, flushes excess rows to Parquet, and shows both merge-scan reads and the change feed.
Prerequisites: Installation completed —
shared_preload_libraries includes koldstore, wal_level=logical, and
CREATE EXTENSION koldstore succeeded.
1. Register storage
storage_type may also be s3, gcs, or azure. For MinIO-style S3:
2. Create a normal heap table
Managed tables need a primary key. Supported types today include boolean,
integers, real, double precision, text, varchar, uuid, jsonb, and
timestamptz.
3. Manage the table
Two equivalent styles:
A. manage_table (structured options)
B. ALTER TABLE options
Do not turn management off with koldstore_enabled = false — use
koldstore.unmanage_table(...) instead. Storage cannot be changed after manage.
With hot_row_limit set, manage_table rejects non-PK UNIQUE constraints and
foreign keys (those stay hot-only after flush). See
Status & Limits.
4. Fence the async mirror
Foreground DML writes the heap only. A database worker applies committed WAL
into the latest-state mirror (koldstore.messages__cl) with short lag. Before
work that must observe every commit visible at the start of the call:
flush_table runs this fence automatically.
5. Page the change feed
Resume with an exclusive cursor (seq > since_seq). Or rewind to the newest N
rows (delivered oldest → newest) when since_seq = 0:
Full semantics: Change Feed.
6. Flush excess rows to cold storage
With hot_row_limit = 1000 and more than 1000 mirror keys, the oldest excess
rows (by mirror seq) move to Parquet and leave the hot heap. Inspect status:
7. Query one table
After flush, cold-capable plans show KoldMergeScan. Hot-only PK lookups that
cannot hit cold may keep a native Index/Seq/Bitmap Scan with no wrapper — that
path is intentional and performance-critical.
What just happened
- PostgreSQL still owns transactions, MVCC, permissions, and the hot heap
- WAL capture wrote latest-state rows into
koldstore.messages__cl - Flush published Parquet segments and pruned flushed hot/mirror rows
SELECTmerges hot + cold;changes_sincepages the same latest-state stream
Next: Under the Hood for the architecture, or Manage & Flush for policy details.