Live Subscriptions
Flags
| Option | Description |
|---|---|
--subscribe <SQL> | Run a live query subscription. |
--subscription-timeout <SECONDS> | Idle timeout after initial data (0 = no timeout). |
--initial-data-timeout <SECONDS> | Max wait for initial data batch (0 = no timeout). |
--list-subscriptions | Print current subscription model/capabilities. |
Interactive commands
| Command | Description |
|---|---|
\live <SQL>, \subscribe <SQL> | Start live subscription (\subscribe is an alias). |
Both routes send a SELECT plus optional trailing OPTIONS (...) to the WebSocket subscription path.
OPTIONS clauses
| Clause | Effect |
|---|---|
OPTIONS (batch_size=<n>) | Limits each initial snapshot batch to at most n rows. |
OPTIONS (last_rows=<n>) | Rewinds the newest n rows as one startup batch. |
OPTIONS (from=<seq_id>) | Starts live delivery after a sequence id (from_seq_id alias accepted). |
Combine options: OPTIONS (last_rows=20, batch_size=5, from=1234).
Examples
Verifying batching
- The CLI prints
BATCH <n>for each startup snapshot page. - With
OPTIONS (batch_size=5)and 20 rows, expect four startup batches of 5. - Startup batches run oldest-to-newest in normal batch mode.
last_rowsis a single-batch rewind of the newest rows, not paginated history.
Example output:
Related
Last updated on