Skip to content

SNAPSHOTREAD

Enables or disables snapshot read mode for the current session.

SNAPSHOTREAD <ON | OFF>
ParameterRequiredDescription
ONYes (one of)Enables snapshot read mode on the session.
OFFYes (one of)Disables snapshot read mode on the session.

Exactly one of ON or OFF must be provided. The argument is case-insensitive.

Simple string: OK on success.

The command sets or clears snapshot read mode on the current session. When enabled, subsequent FoundationDB reads performed by the session use snapshot isolation instead of the default serializable isolation.

Snapshot reads do not create read conflict ranges, which means they will not cause transactions to conflict with concurrent writes to the same keys. This is useful for long-running reads or read-heavy workloads where strict serializability is not required, and reducing transaction conflicts is more important than guaranteeing a perfectly consistent view.

The setting is session-scoped. It persists until explicitly changed or the session ends. It can be toggled at any time, regardless of whether a transaction is currently active.

The following commands honor the SNAPSHOTREAD setting:

CommandHonors SNAPSHOTREAD
ZGETYes
ZGETI64Yes
ZGETF64Yes
ZGETD128Yes
ZGETRANGEYes
ZGETKEYYes
ZGETRANGESIZEYes
BUCKET.QUERYYes
BUCKET.INSERTNo, always uses serializable reads
BUCKET.DELETENo, always uses serializable reads
BUCKET.UPDATENo, always uses serializable reads

Mutation commands (BUCKET.INSERT, BUCKET.DELETE, BUCKET.UPDATE) always use serializable reads regardless of the SNAPSHOTREAD setting.

Error CodeDescription
ERRillegal argument for SNAPSHOTREAD: '<value>': The argument is neither ON nor OFF.

Enable snapshot read mode:

> SNAPSHOTREAD ON
OK

Disable snapshot read mode:

> SNAPSHOTREAD OFF
OK

Invalid argument:

> SNAPSHOTREAD MAYBE
(error) ERR illegal argument for SNAPSHOTREAD: 'MAYBE'