Skip to main content

Documentation Index

Fetch the complete documentation index at: https://s2.dev/docs/llms.txt

Use this file to discover all available pages before exploring further.

Trim point

Trimming removes records before a chosen sequence number, or the trim point. Unlike retention, which is configured as a policy on a stream, trimming is an explicit operation.
s2 trim s2://my-basin/my-stream 1000
Trimming involves appending a trim command record.
The effective trim point will be max(existing_trim_point, min(provided_trim_point, trim_command_seq_num + 1)), so a trim command can trim through itself but not past itself, and it cannot move the trim point backwards.
Trimming is eventually consistent — trimmed records may be visible for a brief period.

Snapshots and compaction

Snapshots bound replay cost by materializing state at a cursor. Trimming can then discard records already covered by the snapshot, but it is optional for external snapshots when you want to keep the full stream history.

See also

Trim with the CLI

Set a stream trim point from the command line.

Command records

See how trim directives are encoded as records.

Snapshots

Bound replay cost with snapshot-and-follow.

Retention

Configure age-based deletion for older records.