Skip to Content
SQL API Reference

SQL API Reference

Signatures match the installed extension SQL today. Prefer named arguments so optional parameters stay readable. Positional calls remain valid.

SQL
-- PreferredSELECT koldstore.register_storage(  name => 'local-dev',  storage_type => 'filesystem',  base_path => '/tmp/koldstore-demo',  credentials => '{}'::jsonb,  config => '{}'::jsonb);

Session helpers

FunctionReturnsMeaning
snowflake_id()bigintMonotonic Snowflake-like id
koldstore_version()textExtension version
koldstore_user_id()textActive koldstore.user_id, or NULL
koldstore.preload_status()jsonbPreload / merge-scan status

Public GUCs

GUCDefaultMeaning
koldstore.user_idemptyScope id for user-typed managed tables
koldstore.cold_readsautoauto / on / off (off errors when cold is required)
koldstore.enable_merge_scanonoff → ERROR at exec (never silent hot-only)
koldstore.max_open_parquet_readers32Per-backend open reader cap (1..=1024)
koldstore.max_merge_seen_keys1000000Per-scan PK identity cap; 0 disables
koldstore.log_levelinfoerror / warn / info / debug / trace
koldstore.min_max_rows_per_file1000Floor for max_rows_per_file
koldstore.flush_check_interval_seconds30Auto-flush worker tick (1..=86400)
koldstore.async_apply_poll_interval_ms100Apply loop latch poll (50..=5000)
koldstore.async_apply_max_rows_per_tick0Max source changes per tick (0 = unlimited)
koldstore.async_apply_max_ms_per_tick0Max ms per tick (0 = unlimited)
koldstore.flush_prelock_max_passes3Flush phase-5.5 pre-lock apply passes
koldstore.flush_prelock_max_ms5000Flush phase-5.5 wall budget
koldstore.async_mirror_max_retained_bytes1 GiBHealth threshold only — never blocks apply

Internal GUCs (internal_system_write, internal_flush_cleanup) are reserved for extension maintenance paths and cannot be set by application roles.

Configure durable settings with ALTER SYSTEM / ALTER DATABASE / ALTER ROLE and follow PostgreSQL reload rules. Session SET does not always reach the background worker.

Function catalog

FunctionReturns
koldstore.register_storage(...)uuid
koldstore.alter_storage_credentials(...)void
koldstore.alter_storage_location(...)uuid
koldstore.manage_table(...)uuid (migration job id)
koldstore.set_table_auto_flush(...)boolean
koldstore.unmanage_table(...)bigint
koldstore.wait_for_async_mirror()bigint
koldstore.async_mirror_status()jsonb
koldstore.async_mirror_slot_name()text
koldstore.disable_async_mirror()boolean
koldstore.enqueue_flush_job(...)bigint (1 / 0)
koldstore.flush_table(...)uuid
koldstore.list_jobs(...)jsonb array
koldstore.cancel_job(...) / cancel_table_jobs(...)cancel status
koldstore.describe_table(...)jsonb
koldstore.recover_segments(...)bigint
koldstore.changes_since(...)set of change rows

Storage

SQL
SELECT koldstore.register_storage(  name         => 'local-dev',  storage_type => 'filesystem',  -- filesystem | s3 | gcs | azure  base_path    => '/tmp/koldstore-demo',  credentials  => '{}'::jsonb,  config       => '{}'::jsonb  -- optional: regular_path_tmpl, scoped_path_tmpl); SELECT koldstore.alter_storage_credentials(  name => 'local-dev',  credentials => '{"access_key_id":"...","secret_access_key":"..."}'::jsonb); SELECT koldstore.alter_storage_location(  name => 'local-dev',  base_path => '/var/lib/koldstore',  config => '{}'::jsonb);

Default path templates: {namespace}/{tableName}/ and {namespace}/{tableName}/{scopeId}/.

Manage / unmanage

See Manage & Flush for parameters and policy examples. Quick reference:

SQL
SELECT koldstore.manage_table(  table_name => 'chat.messages',  storage => 's3_archive',  hot_row_limit => 10000); SELECT koldstore.set_table_auto_flush('chat.messages'::regclass, false); SELECT koldstore.unmanage_table(  table_name => 'chat.messages'::regclass,  rehydrate => true,  drop_cold => false);

Async mirror

SQL
SELECT koldstore.wait_for_async_mirror();  -- strong fence; 0 ≠ disabledSELECT koldstore.async_mirror_status();SELECT koldstore.async_mirror_slot_name();-- After unmanaging every table:SELECT koldstore.disable_async_mirror();

Flush and jobs

SQL
SELECT koldstore.enqueue_flush_job(table_name => 'chat.messages'::regclass);SELECT koldstore.flush_table(table_name => 'chat.messages'::regclass, force => false);SELECT koldstore.list_jobs();SELECT koldstore.describe_table(table_name => 'chat.messages'::regclass);SELECT koldstore.recover_segments(table_name => 'chat.messages'::regclass, dry_run => true);

Change feed

SQL
SELECT * FROM koldstore.changes_since(  table_name => 'chat.messages'::regclass,  since_seq => 0,  limit_rows => 1000,  last_rows => NULL);

Full semantics: Change Feed.

Not shipped yet (do not call)

Documented as roadmap / ops intent only:

  • Cold DML helpers (hydrate_pk, cold update_row / delete_row)
  • backup_manifest, validate_cold_storage, packaged export/import
  • Packaged ALTER EXTENSION … UPDATE edges

Standard SQL UPDATE/DELETE that only matches cold rows affects zero hot rows in the current MVP — use unmanage/rehydrate paths when you need cold rows back in the heap.

Next

Last updated on