GETAPPROXIMATESIZE
Returns the approximate byte size of the current transaction.
Syntax
Section titled “Syntax”GETAPPROXIMATESIZEThis command takes no parameters.
Return Value
Section titled “Return Value”Integer: the approximate size of the transaction in bytes.
Behavior
Section titled “Behavior”Returns the approximate number of bytes of mutations that have been performed on the current transaction. This value includes the combined size of all keys and values that have been set, cleared, or otherwise mutated since the transaction began.
This is useful for monitoring how much data a transaction has written, particularly when approaching FoundationDB’s 10 MB transaction size limit. Clients can use this to decide when to split work across multiple transactions or for logging and diagnostics.
A transaction must be started with BEGIN before calling this command.
Errors
Section titled “Errors”| Error Code | Description |
|---|---|
TRANSACTION | there is no transaction in progress.: No active transaction on the session. |
Examples
Section titled “Examples”Check approximate size after performing writes:
> BEGINOK
> ZSET key1 42OK
> GETAPPROXIMATESIZE(integer) 156Attempt without an active transaction:
> GETAPPROXIMATESIZE(error) TRANSACTION there is no transaction in progress.