Skip to content

Limits

Size, memory, connection and output limits of the gateway and extension.

Gateway limits bound request frames, reply frames, and PostgreSQL wire buffers in the pgredis Go process. Extension limits bound temporary workspace allocations, shared-memory rings, and session tables inside PostgreSQL 18. Neither replaces OS or PostgreSQL cluster-wide memory limits (shared_buffers, work_mem, container cgroup limits).

Gateway buffer limits

ResourceFlagDefault limit
Single bulk argument-max-bulk-bytes512 MiB (536,870,912 bytes)
Total argument bytes in one request frame-max-frame-bytes1 GiB + 1 MiB (1,074,790,400 bytes)
Unauthenticated request header (AUTH pending)Built-in10 arguments, 16,384 bytes per bulk argument
Complete wire reply (including EXEC array)-max-reply-bytes1 GiB + 1 MiB (1,074,790,400 bytes)
Shared live input payload and bookkeeping-max-input-bytes2 GiB (2,147,483,648 bytes)
Shared live output payload and workspace-max-output-bytes2 GiB (2,147,483,648 bytes)
Shared PostgreSQL receive buffer budget-max-pg-read-bytes2 GiB (2,147,483,648 bytes)
Single PostgreSQL wire message body-max-pg-message-bytes1 GiB - 2 B (1,073,741,822 bytes)
  • Local pgx read-budget patch: During make build, scripts/prepare_pgx.py applies patches/pgx-v5.11.0-read-budget.patch to the Go driver so oversized PostgreSQL wire messages and shared -max-pg-read-bytes budgets are enforced before allocating full message bodies in memory.
  • Post-commit output rejection: A mutating SQL statement can commit inside PostgreSQL before the gateway rejects an oversized reply against -max-reply-bytes or -max-output-bytes. Callers that lose a connection or receive an output-budget error must treat the write outcome as UNKNOWN.

Extension workspace and session limits

ComponentDefault limitBehavior when exceeded
Per-backend C workspace and reply budget2 GiBRaises a PostgreSQL error and rolls back the statement or savepoint.
Shared preload memory budget (shared_preload_libraries)2 GiBBounds shared allocations across backends.
MONITOR shared-memory ring4 MiB / 4,096 entriesDrops stalled MONITOR cursors that fall behind the ring head.
Pub/Sub queue per client1 MiB / 1,024 framesMarks the session failed and closes the subscriber connection.
Total retained Pub/Sub payload64 MiB (4,096 sessions, 16,384 subscriptions)Rejects new publications/registrations and fails overflowing routes.

In SET ... GET and GETSET, the C extension releases the temporary replacement copy as soon as storage consumes it and before constructing the old-value reply, allowing full 512 MiB replacements within the default 2 GiB backend budget.

Mutation counter compaction

pg_redis tracks logical key mutations across backends using per-backend counter rows so concurrent writers do not contend on a single sequence row:

  • Once the counter table reaches 64 rows, the background maintenance worker compacts up to 64 unlocked rows per pass into a single retained row while preserving the exact SQL SUM.
  • Rows locked by active or prepared transactions (PREPARE TRANSACTION) are skipped, and any batch whose sum would overflow bigint is left untouched.
  • Compaction bounds the number of rows modified per maintenance pass; dead row versions are reclaimed by standard PostgreSQL VACUUM.

Verified 512 MiB capacity baseline

On Linux (3fc740ca5, 2026-10-15, 4 CPUs, 8 GiB RAM, no swap, PostgreSQL 18.6), the installed gateway and extension passed the full 512 MiB String suite across native and redis-acl authentication modes in both RESP2 and RESP3:

  • Verified byte-for-byte across 16 large write/replace requests (SET, SET ... GET, GETSET), 24 large replies, 32 direct SQL state observations, and clean PostgreSQL restart readbacks without OOM.
  • All tested 512 MiB keys had no TTL; large-value crash recovery with finite TTLs and multi-client concurrent 512 MiB streams require separate evaluation. See Status for current performance and test coverage.
Scan to open this page
https://mimus.pgsty.com/docs/redis/reference/limits/

Table reader