Manage & Flush
Managing a table attaches KoldStore policy and WAL mirror capture. Flushing moves eligible latest-state rows from the hot heap into Parquet and prunes them from PostgreSQL.
Enable management
Prefer named arguments. hot_row_limit is required in the manage_table call
— pass NULL for hot-only tables that should not flush.
| Parameter | Default | Meaning |
|---|---|---|
table_name | required | Table to manage (regclass) |
storage | required | Registered storage backend name |
hot_row_limit | required (NULL allowed) | Max mirror rows to keep hot |
min_flush_rows | 1000 | Minimum excess before a policy flush moves data |
max_rows_per_file | 1000 | Max rows per Parquet segment (floor via koldstore.min_max_rows_per_file) |
table_type | 'shared' | shared or user (+ scope_column) |
compression | NULL | Optional Parquet codec (snappy, zstd, uncompressed) |
target_file_size_mb | NULL | Stored for future size-aware flush |
auto_flush | true | Let the DB worker evaluate and run needed flushes |
ALTER TABLE style
Age-based eviction (mutually exclusive with hot_row_limit):
Age is measured from the latest captured mirror mutation encoded in seq.
Flush
Policy flush
Keeps the newest rows hot by mirror seq and flushes oldest eligible excess
first, honoring hot_row_limit / min_flush_rows / max_rows_per_file.
Force flush
Flushes all pending mirror rows. Use carefully on large tables.
Enqueue without running
Returns 1 if a job was inserted, 0 if an active flush job already exists.
auto_flush does not gate manual flush / enqueue.
Inspect progress
Useful describe_table fields: hot_rows, mirror_rows, cold_row_count,
cold_segment_count, heap/index sizes, manifest_state, pending_jobs,
last_error.
Cancel
Pending jobs cancel immediately when unlocked. Running jobs stop cooperatively
at the next wave boundary. If cancel lands after cold publish already committed,
the job may finish completed with
payload.cancel_requested_after_publish = true (data is not unpublished).
Auto-flush toggle
Manual flush_table still works. See Operations
for the built-in worker tick and pg_cron fallback.
Unmanage
Use this instead of koldstore_enabled = false. Optional rehydrate /
drop_cold control whether cold rows return to the heap and whether cold
objects are deleted.