This is the multi-page printable view of this section.
Reference
- 1: Commands
- 2: Data types
- 3: SQL API
- 4: Transactions and retries
- 5: Pub/Sub and keyspace events
- 6: Streams and consumer groups
- 7: Configuration
- 8: Limits
This section documents the pgredis wire commands, PostgreSQL SQL functions, transaction and notification contracts, gateway flags, extension GUCs, and resource budgets.
Reference pages
Commands
All 392 Redis 7.2.4 command and subcommand entries fromspec/commands.json, grouped by family with implementation state.Data types
Strings, Hashes, Lists, Sets, Sorted Sets, Streams, Bitmaps, HyperLogLog, GEO, and object inspection commands.SQL API
redis.command,redis.command_bin, multi-transaction blocking and Pub/Sub session functions, and SQLSTATE error codes.Transactions and retries
MULTI/EXEC,WATCH, SQL transaction participation, and handlingUNKNOWNoutcomes after lost responses.Pub/Sub and keyspace events
Channel, pattern, and sharded subscriptions,notify-keyspace-events, and backpressure limits.Streams and consumer groups
Stream IDs,XADD/XRANGE/XTRIM, consumer groups, pending entries (XPENDING,XCLAIM,XAUTOCLAIM), and blocking reads.Configuration
pgredisgateway CLI flags, connection pools,pg_redisextension GUCs, and supportedCONFIG GET/SETparameters.Limits
Request, reply, shared buffer, and backend workspace budgets, mutation-counter compaction, and tested 512 MiB capacity.
1 - Commands
This page is generated from spec/commands.json in the pgredis repository (v0.1.0-rc1, schema 0.54, commit 11411411d72ab45456904cc602cefbb13b68ff25), which tracks 392 Redis 7.2.4 command and subcommand entries:
- 305 entries are marked
partial-slice(implemented in the C extension, Go gateway, or both). - 87 entries are marked
pending(32 Cluster, 22 Sentinel, 19 Scripting, and 14 Server commands that return explicit unsupported errors). - All 392 entries carry
compatibility_verified: falsein the specification file:partial-slicerecords implementation presence, not full certification. See Compatibility and Status for dated test results.
In the arity column, a positive integer is the exact argument count including the command word, and a negative integer is the minimum argument count (for example, -3 for SET means at least command, key, and value).
Summary by family
| Family | Total | partial-slice | pending | Execution owner |
|---|---|---|---|---|
| String | 22 | 22 | 0 | extension |
| Hash | 16 | 16 | 0 | extension |
| List | 22 | 22 | 0 | extension |
| Set | 17 | 17 | 0 | extension |
| Sorted set | 35 | 35 | 0 | extension |
| Stream | 25 | 25 | 0 | extension |
| Bitmap | 7 | 7 | 0 | extension |
| GEO | 10 | 10 | 0 | extension |
| HyperLogLog | 5 | 5 | 0 | extension |
| Keyspace | 34 | 34 | 0 | extension |
| Transactions | 5 | 5 | 0 | gateway+extension |
| Pub/Sub | 15 | 15 | 0 | extension |
| Connection | 26 | 26 | 0 | extension, gateway, gateway+extension |
| Server | 76 | 62 | 14 | extension |
| Cluster | 32 | 0 | 32 | extension |
| Sentinel | 22 | 0 | 22 | extension |
| Scripting | 23 | 4 | 19 | extension |
String
| Command | Arity | Owner | Implementation |
|---|---|---|---|
APPEND | 3 | extension | partial-slice |
DECR | 2 | extension | partial-slice |
DECRBY | 3 | extension | partial-slice |
GET | 2 | extension | partial-slice |
GETDEL | 2 | extension | partial-slice |
GETEX | -2 | extension | partial-slice |
GETRANGE | 4 | extension | partial-slice |
GETSET | 3 | extension | partial-slice |
INCR | 2 | extension | partial-slice |
INCRBY | 3 | extension | partial-slice |
INCRBYFLOAT | 3 | extension | partial-slice |
LCS | -3 | extension | partial-slice |
MGET | -2 | extension | partial-slice |
MSET | -3 | extension | partial-slice |
MSETNX | -3 | extension | partial-slice |
PSETEX | 4 | extension | partial-slice |
SET | -3 | extension | partial-slice |
SETEX | 4 | extension | partial-slice |
SETNX | 3 | extension | partial-slice |
SETRANGE | 4 | extension | partial-slice |
STRLEN | 2 | extension | partial-slice |
SUBSTR | 4 | extension | partial-slice |
Hash
| Command | Arity | Owner | Implementation |
|---|---|---|---|
HDEL | -3 | extension | partial-slice |
HEXISTS | 3 | extension | partial-slice |
HGET | 3 | extension | partial-slice |
HGETALL | 2 | extension | partial-slice |
HINCRBY | 4 | extension | partial-slice |
HINCRBYFLOAT | 4 | extension | partial-slice |
HKEYS | 2 | extension | partial-slice |
HLEN | 2 | extension | partial-slice |
HMGET | -3 | extension | partial-slice |
HMSET | -4 | extension | partial-slice |
HRANDFIELD | -2 | extension | partial-slice |
HSCAN | -3 | extension | partial-slice |
HSET | -4 | extension | partial-slice |
HSETNX | 4 | extension | partial-slice |
HSTRLEN | 3 | extension | partial-slice |
HVALS | 2 | extension | partial-slice |
List
| Command | Arity | Owner | Implementation |
|---|---|---|---|
BLMOVE | 6 | extension | partial-slice |
BLMPOP | -5 | extension | partial-slice |
BLPOP | -3 | extension | partial-slice |
BRPOP | -3 | extension | partial-slice |
BRPOPLPUSH | 4 | extension | partial-slice |
LINDEX | 3 | extension | partial-slice |
LINSERT | 5 | extension | partial-slice |
LLEN | 2 | extension | partial-slice |
LMOVE | 5 | extension | partial-slice |
LMPOP | -4 | extension | partial-slice |
LPOP | -2 | extension | partial-slice |
LPOS | -3 | extension | partial-slice |
LPUSH | -3 | extension | partial-slice |
LPUSHX | -3 | extension | partial-slice |
LRANGE | 4 | extension | partial-slice |
LREM | 4 | extension | partial-slice |
LSET | 4 | extension | partial-slice |
LTRIM | 4 | extension | partial-slice |
RPOP | -2 | extension | partial-slice |
RPOPLPUSH | 3 | extension | partial-slice |
RPUSH | -3 | extension | partial-slice |
RPUSHX | -3 | extension | partial-slice |
Set
| Command | Arity | Owner | Implementation |
|---|---|---|---|
SADD | -3 | extension | partial-slice |
SCARD | 2 | extension | partial-slice |
SDIFF | -2 | extension | partial-slice |
SDIFFSTORE | -3 | extension | partial-slice |
SINTER | -2 | extension | partial-slice |
SINTERCARD | -3 | extension | partial-slice |
SINTERSTORE | -3 | extension | partial-slice |
SISMEMBER | 3 | extension | partial-slice |
SMEMBERS | 2 | extension | partial-slice |
SMISMEMBER | -3 | extension | partial-slice |
SMOVE | 4 | extension | partial-slice |
SPOP | -2 | extension | partial-slice |
SRANDMEMBER | -2 | extension | partial-slice |
SREM | -3 | extension | partial-slice |
SSCAN | -3 | extension | partial-slice |
SUNION | -2 | extension | partial-slice |
SUNIONSTORE | -3 | extension | partial-slice |
Sorted set
| Command | Arity | Owner | Implementation |
|---|---|---|---|
BZMPOP | -5 | extension | partial-slice |
BZPOPMAX | -3 | extension | partial-slice |
BZPOPMIN | -3 | extension | partial-slice |
ZADD | -4 | extension | partial-slice |
ZCARD | 2 | extension | partial-slice |
ZCOUNT | 4 | extension | partial-slice |
ZDIFF | -3 | extension | partial-slice |
ZDIFFSTORE | -4 | extension | partial-slice |
ZINCRBY | 4 | extension | partial-slice |
ZINTER | -3 | extension | partial-slice |
ZINTERCARD | -3 | extension | partial-slice |
ZINTERSTORE | -4 | extension | partial-slice |
ZLEXCOUNT | 4 | extension | partial-slice |
ZMPOP | -4 | extension | partial-slice |
ZMSCORE | -3 | extension | partial-slice |
ZPOPMAX | -2 | extension | partial-slice |
ZPOPMIN | -2 | extension | partial-slice |
ZRANDMEMBER | -2 | extension | partial-slice |
ZRANGE | -4 | extension | partial-slice |
ZRANGEBYLEX | -4 | extension | partial-slice |
ZRANGEBYSCORE | -4 | extension | partial-slice |
ZRANGESTORE | -5 | extension | partial-slice |
ZRANK | -3 | extension | partial-slice |
ZREM | -3 | extension | partial-slice |
ZREMRANGEBYLEX | 4 | extension | partial-slice |
ZREMRANGEBYRANK | 4 | extension | partial-slice |
ZREMRANGEBYSCORE | 4 | extension | partial-slice |
ZREVRANGE | -4 | extension | partial-slice |
ZREVRANGEBYLEX | -4 | extension | partial-slice |
ZREVRANGEBYSCORE | -4 | extension | partial-slice |
ZREVRANK | -3 | extension | partial-slice |
ZSCAN | -3 | extension | partial-slice |
ZSCORE | 3 | extension | partial-slice |
ZUNION | -3 | extension | partial-slice |
ZUNIONSTORE | -4 | extension | partial-slice |
Stream
| Command | Arity | Owner | Implementation |
|---|---|---|---|
XACK | -4 | extension | partial-slice |
XADD | -5 | extension | partial-slice |
XAUTOCLAIM | -6 | extension | partial-slice |
XCLAIM | -6 | extension | partial-slice |
XDEL | -3 | extension | partial-slice |
XGROUP | -2 | extension | partial-slice |
XGROUP CREATE | -5 | extension | partial-slice |
XGROUP CREATECONSUMER | 5 | extension | partial-slice |
XGROUP DELCONSUMER | 5 | extension | partial-slice |
XGROUP DESTROY | 4 | extension | partial-slice |
XGROUP HELP | 2 | extension | partial-slice |
XGROUP SETID | -5 | extension | partial-slice |
XINFO | -2 | extension | partial-slice |
XINFO CONSUMERS | 4 | extension | partial-slice |
XINFO GROUPS | 3 | extension | partial-slice |
XINFO HELP | 2 | extension | partial-slice |
XINFO STREAM | -3 | extension | partial-slice |
XLEN | 2 | extension | partial-slice |
XPENDING | -3 | extension | partial-slice |
XRANGE | -4 | extension | partial-slice |
XREAD | -4 | extension | partial-slice |
XREADGROUP | -7 | extension | partial-slice |
XREVRANGE | -4 | extension | partial-slice |
XSETID | -3 | extension | partial-slice |
XTRIM | -4 | extension | partial-slice |
Bitmap
| Command | Arity | Owner | Implementation |
|---|---|---|---|
BITCOUNT | -2 | extension | partial-slice |
BITFIELD | -2 | extension | partial-slice |
BITFIELD_RO | -2 | extension | partial-slice |
BITOP | -4 | extension | partial-slice |
BITPOS | -3 | extension | partial-slice |
GETBIT | 3 | extension | partial-slice |
SETBIT | 4 | extension | partial-slice |
GEO
| Command | Arity | Owner | Implementation |
|---|---|---|---|
GEOADD | -5 | extension | partial-slice |
GEODIST | -4 | extension | partial-slice |
GEOHASH | -2 | extension | partial-slice |
GEOPOS | -2 | extension | partial-slice |
GEORADIUS | -6 | extension | partial-slice |
GEORADIUSBYMEMBER | -5 | extension | partial-slice |
GEORADIUSBYMEMBER_RO | -5 | extension | partial-slice |
GEORADIUS_RO | -6 | extension | partial-slice |
GEOSEARCH | -7 | extension | partial-slice |
GEOSEARCHSTORE | -8 | extension | partial-slice |
HyperLogLog
| Command | Arity | Owner | Implementation |
|---|---|---|---|
PFADD | -2 | extension | partial-slice |
PFCOUNT | -2 | extension | partial-slice |
PFDEBUG | 3 | extension | partial-slice |
PFMERGE | -2 | extension | partial-slice |
PFSELFTEST | 1 | extension | partial-slice |
Keyspace
| Command | Arity | Owner | Implementation |
|---|---|---|---|
COPY | -3 | extension | partial-slice |
DEL | -2 | extension | partial-slice |
DUMP | 2 | extension | partial-slice |
EXISTS | -2 | extension | partial-slice |
EXPIRE | -3 | extension | partial-slice |
EXPIREAT | -3 | extension | partial-slice |
EXPIRETIME | 2 | extension | partial-slice |
KEYS | 2 | extension | partial-slice |
MIGRATE | -6 | extension | partial-slice |
MOVE | 3 | extension | partial-slice |
OBJECT | -2 | extension | partial-slice |
OBJECT ENCODING | 3 | extension | partial-slice |
OBJECT FREQ | 3 | extension | partial-slice |
OBJECT HELP | 2 | extension | partial-slice |
OBJECT IDLETIME | 3 | extension | partial-slice |
OBJECT REFCOUNT | 3 | extension | partial-slice |
PERSIST | 2 | extension | partial-slice |
PEXPIRE | -3 | extension | partial-slice |
PEXPIREAT | -3 | extension | partial-slice |
PEXPIRETIME | 2 | extension | partial-slice |
PTTL | 2 | extension | partial-slice |
RANDOMKEY | 1 | extension | partial-slice |
RENAME | 3 | extension | partial-slice |
RENAMENX | 3 | extension | partial-slice |
RESTORE | -4 | extension | partial-slice |
SCAN | -2 | extension | partial-slice |
SORT | -2 | extension | partial-slice |
SORT_RO | -2 | extension | partial-slice |
TOUCH | -2 | extension | partial-slice |
TTL | 2 | extension | partial-slice |
TYPE | 2 | extension | partial-slice |
UNLINK | -2 | extension | partial-slice |
WAIT | 3 | extension | partial-slice |
WAITAOF | 4 | extension | partial-slice |
Transactions
| Command | Arity | Owner | Implementation |
|---|---|---|---|
DISCARD | 1 | gateway+extension | partial-slice |
EXEC | 1 | gateway+extension | partial-slice |
MULTI | 1 | gateway+extension | partial-slice |
UNWATCH | 1 | gateway+extension | partial-slice |
WATCH | -2 | gateway+extension | partial-slice |
Pub/Sub
| Command | Arity | Owner | Implementation |
|---|---|---|---|
PSUBSCRIBE | -2 | extension | partial-slice |
PUBLISH | 3 | extension | partial-slice |
PUBSUB | -2 | extension | partial-slice |
PUBSUB CHANNELS | -2 | extension | partial-slice |
PUBSUB HELP | 2 | extension | partial-slice |
PUBSUB NUMPAT | 2 | extension | partial-slice |
PUBSUB NUMSUB | -2 | extension | partial-slice |
PUBSUB SHARDCHANNELS | -2 | extension | partial-slice |
PUBSUB SHARDNUMSUB | -2 | extension | partial-slice |
PUNSUBSCRIBE | -1 | extension | partial-slice |
SPUBLISH | 3 | extension | partial-slice |
SSUBSCRIBE | -2 | extension | partial-slice |
SUBSCRIBE | -2 | extension | partial-slice |
SUNSUBSCRIBE | -1 | extension | partial-slice |
UNSUBSCRIBE | -1 | extension | partial-slice |
Connection
| Command | Arity | Owner | Implementation |
|---|---|---|---|
AUTH | -2 | gateway | partial-slice |
CLIENT | -2 | extension | partial-slice |
CLIENT CACHING | 3 | extension | partial-slice |
CLIENT GETNAME | 2 | gateway | partial-slice |
CLIENT GETREDIR | 2 | extension | partial-slice |
CLIENT HELP | 2 | extension | partial-slice |
CLIENT ID | 2 | extension | partial-slice |
CLIENT INFO | 2 | extension | partial-slice |
CLIENT KILL | -3 | extension | partial-slice |
CLIENT LIST | -2 | extension | partial-slice |
CLIENT NO-EVICT | 3 | extension | partial-slice |
CLIENT NO-TOUCH | 3 | gateway+extension | partial-slice |
CLIENT PAUSE | -3 | extension | partial-slice |
CLIENT REPLY | 3 | extension | partial-slice |
CLIENT SETINFO | 4 | gateway | partial-slice |
CLIENT SETNAME | 3 | gateway | partial-slice |
CLIENT TRACKING | -3 | extension | partial-slice |
CLIENT TRACKINGINFO | 2 | extension | partial-slice |
CLIENT UNBLOCK | -3 | extension | partial-slice |
CLIENT UNPAUSE | 2 | extension | partial-slice |
ECHO | 2 | gateway | partial-slice |
HELLO | -1 | gateway | partial-slice |
PING | -1 | gateway | partial-slice |
QUIT | -1 | gateway | partial-slice |
RESET | 1 | gateway | partial-slice |
SELECT | 2 | gateway | partial-slice |
Server
| Command | Arity | Owner | Implementation |
|---|---|---|---|
ACL | -2 | extension | partial-slice |
ACL CAT | -2 | extension | partial-slice |
ACL DELUSER | -3 | extension | partial-slice |
ACL DRYRUN | -4 | extension | partial-slice |
ACL GENPASS | -2 | extension | partial-slice |
ACL GETUSER | 3 | extension | partial-slice |
ACL HELP | 2 | extension | partial-slice |
ACL LIST | 2 | extension | partial-slice |
ACL LOAD | 2 | extension | partial-slice |
ACL LOG | -2 | extension | partial-slice |
ACL SAVE | 2 | extension | partial-slice |
ACL SETUSER | -3 | extension | partial-slice |
ACL USERS | 2 | extension | partial-slice |
ACL WHOAMI | 2 | extension | partial-slice |
BGREWRITEAOF | 1 | extension | pending |
BGSAVE | -1 | extension | pending |
COMMAND | -1 | extension | partial-slice |
COMMAND COUNT | 2 | extension | partial-slice |
COMMAND DOCS | -2 | extension | partial-slice |
COMMAND GETKEYS | -3 | extension | partial-slice |
COMMAND GETKEYSANDFLAGS | -3 | extension | partial-slice |
COMMAND HELP | 2 | extension | partial-slice |
COMMAND INFO | -2 | extension | partial-slice |
COMMAND LIST | -2 | extension | partial-slice |
CONFIG | -2 | extension | partial-slice |
CONFIG GET | -3 | extension | partial-slice |
CONFIG HELP | 2 | extension | partial-slice |
CONFIG RESETSTAT | 2 | extension | partial-slice |
CONFIG REWRITE | 2 | extension | partial-slice |
CONFIG SET | -4 | extension | partial-slice |
DBSIZE | 1 | extension | partial-slice |
DEBUG | -2 | extension | partial-slice |
FAILOVER | -1 | extension | pending |
FLUSHALL | -1 | extension | partial-slice |
FLUSHDB | -1 | extension | partial-slice |
INFO | -1 | extension | partial-slice |
LASTSAVE | 1 | extension | partial-slice |
LATENCY | -2 | extension | partial-slice |
LATENCY DOCTOR | 2 | extension | partial-slice |
LATENCY GRAPH | 3 | extension | partial-slice |
LATENCY HELP | 2 | extension | partial-slice |
LATENCY HISTOGRAM | -2 | extension | partial-slice |
LATENCY HISTORY | 3 | extension | partial-slice |
LATENCY LATEST | 2 | extension | partial-slice |
LATENCY RESET | -2 | extension | partial-slice |
LOLWUT | -1 | extension | partial-slice |
MEMORY | -2 | extension | partial-slice |
MEMORY DOCTOR | 2 | extension | partial-slice |
MEMORY HELP | 2 | extension | partial-slice |
MEMORY MALLOC-STATS | 2 | extension | partial-slice |
MEMORY PURGE | 2 | extension | partial-slice |
MEMORY STATS | 2 | extension | partial-slice |
MEMORY USAGE | -3 | extension | partial-slice |
MODULE | -2 | extension | partial-slice |
MODULE HELP | 2 | extension | partial-slice |
MODULE LIST | 2 | extension | partial-slice |
MODULE LOAD | -3 | extension | pending |
MODULE LOADEX | -3 | extension | pending |
MODULE UNLOAD | 3 | extension | pending |
MONITOR | 1 | extension | partial-slice |
PSYNC | -3 | extension | pending |
REPLCONF | -1 | extension | pending |
REPLICAOF | 3 | extension | pending |
RESTORE-ASKING | -4 | extension | pending |
ROLE | 1 | extension | partial-slice |
SAVE | 1 | extension | pending |
SHUTDOWN | -1 | extension | pending |
SLAVEOF | 3 | extension | pending |
SLOWLOG | -2 | extension | partial-slice |
SLOWLOG GET | -2 | extension | partial-slice |
SLOWLOG HELP | 2 | extension | partial-slice |
SLOWLOG LEN | 2 | extension | partial-slice |
SLOWLOG RESET | 2 | extension | partial-slice |
SWAPDB | 3 | extension | partial-slice |
SYNC | 1 | extension | pending |
TIME | 1 | extension | partial-slice |
Cluster
| Command | Arity | Owner | Implementation |
|---|---|---|---|
ASKING | 1 | extension | pending |
CLUSTER | -2 | extension | pending |
CLUSTER ADDSLOTS | -3 | extension | pending |
CLUSTER ADDSLOTSRANGE | -4 | extension | pending |
CLUSTER BUMPEPOCH | 2 | extension | pending |
CLUSTER COUNT-FAILURE-REPORTS | 3 | extension | pending |
CLUSTER COUNTKEYSINSLOT | 3 | extension | pending |
CLUSTER DELSLOTS | -3 | extension | pending |
CLUSTER DELSLOTSRANGE | -4 | extension | pending |
CLUSTER FAILOVER | -2 | extension | pending |
CLUSTER FLUSHSLOTS | 2 | extension | pending |
CLUSTER FORGET | 3 | extension | pending |
CLUSTER GETKEYSINSLOT | 4 | extension | pending |
CLUSTER HELP | 2 | extension | pending |
CLUSTER INFO | 2 | extension | pending |
CLUSTER KEYSLOT | 3 | extension | pending |
CLUSTER LINKS | 2 | extension | pending |
CLUSTER MEET | -4 | extension | pending |
CLUSTER MYID | 2 | extension | pending |
CLUSTER MYSHARDID | 2 | extension | pending |
CLUSTER NODES | 2 | extension | pending |
CLUSTER REPLICAS | 3 | extension | pending |
CLUSTER REPLICATE | 3 | extension | pending |
CLUSTER RESET | -2 | extension | pending |
CLUSTER SAVECONFIG | 2 | extension | pending |
CLUSTER SET-CONFIG-EPOCH | 3 | extension | pending |
CLUSTER SETSLOT | -4 | extension | pending |
CLUSTER SHARDS | 2 | extension | pending |
CLUSTER SLAVES | 3 | extension | pending |
CLUSTER SLOTS | 2 | extension | pending |
READONLY | 1 | extension | pending |
READWRITE | 1 | extension | pending |
Sentinel
| Command | Arity | Owner | Implementation |
|---|---|---|---|
SENTINEL | -2 | extension | pending |
SENTINEL CKQUORUM | 3 | extension | pending |
SENTINEL CONFIG | -4 | extension | pending |
SENTINEL DEBUG | -2 | extension | pending |
SENTINEL FAILOVER | 3 | extension | pending |
SENTINEL FLUSHCONFIG | 2 | extension | pending |
SENTINEL GET-MASTER-ADDR-BY-NAME | 3 | extension | pending |
SENTINEL HELP | 2 | extension | pending |
SENTINEL INFO-CACHE | -3 | extension | pending |
SENTINEL IS-MASTER-DOWN-BY-ADDR | 6 | extension | pending |
SENTINEL MASTER | 3 | extension | pending |
SENTINEL MASTERS | 2 | extension | pending |
SENTINEL MONITOR | 6 | extension | pending |
SENTINEL MYID | 2 | extension | pending |
SENTINEL PENDING-SCRIPTS | 2 | extension | pending |
SENTINEL REMOVE | 3 | extension | pending |
SENTINEL REPLICAS | 3 | extension | pending |
SENTINEL RESET | 3 | extension | pending |
SENTINEL SENTINELS | 3 | extension | pending |
SENTINEL SET | -5 | extension | pending |
SENTINEL SIMULATE-FAILURE | -3 | extension | pending |
SENTINEL SLAVES | 3 | extension | pending |
Scripting
| Command | Arity | Owner | Implementation |
|---|---|---|---|
EVAL | -3 | extension | pending |
EVALSHA | -3 | extension | pending |
EVALSHA_RO | -3 | extension | pending |
EVAL_RO | -3 | extension | pending |
FCALL | -3 | extension | pending |
FCALL_RO | -3 | extension | pending |
FUNCTION | -2 | extension | partial-slice |
FUNCTION DELETE | 3 | extension | pending |
FUNCTION DUMP | 2 | extension | pending |
FUNCTION FLUSH | -2 | extension | partial-slice |
FUNCTION HELP | 2 | extension | pending |
FUNCTION KILL | 2 | extension | pending |
FUNCTION LIST | -2 | extension | pending |
FUNCTION LOAD | -3 | extension | pending |
FUNCTION RESTORE | -3 | extension | pending |
FUNCTION STATS | 2 | extension | pending |
SCRIPT | -2 | extension | partial-slice |
SCRIPT DEBUG | 3 | extension | pending |
SCRIPT EXISTS | -3 | extension | pending |
SCRIPT FLUSH | -2 | extension | partial-slice |
SCRIPT HELP | 2 | extension | pending |
SCRIPT KILL | 2 | extension | pending |
SCRIPT LOAD | 3 | extension | pending |
2 - Data types
pgredis implements command families for the core Redis 7.2.4 data types and derived structures inside PostgreSQL 18 tables. Every key has one metadata row in redis._keyspace and stores its payload in the matching typed table. See Storage for the underlying table layout and Commands for the per-command list.
Core types
| Type | Backing table | Primary use | Representative commands |
|---|---|---|---|
| String | redis._string | Byte sequences, integers, floats, or bitmaps | SET, GET, MSET, MGET, INCR, INCRBYFLOAT, LCS |
| Hash | redis._hash | Field/value maps under one key | HSET, HGET, HMGET, HGETALL, HINCRBY, HRANDFIELD, HSCAN |
| List | redis._list, redis._list_length | Ordered sequences of elements (duplicates allowed) | LPUSH, RPUSH, LPOP, LRANGE, LINDEX, LINSERT, BLMOVE, BLPOP |
| Set | redis._set | Unordered collections of unique members | SADD, SREM, SMEMBERS, SISMEMBER, SUNION, SINTER, SSCAN |
| Sorted set | redis._zset | Unique members ordered by float8 score, then raw member bytes | ZADD, ZRANGE, ZREM, ZSCORE, ZRANK, ZUNIONSTORE, BZPOPMIN |
| Stream | redis._stream, redis._stream_group, redis._stream_pel | Append-only entries ordered by (ms, seq) ID with consumer groups | XADD, XRANGE, XREAD, XGROUP, XREADGROUP, XACK, XAUTOCLAIM |
Keys, string values, hash fields, list elements, set members, and sorted-set members are stored as bytea and preserve arbitrary binary sequences, including NUL (\x00) bytes. When calling from SQL with non-UTF-8 or NUL-containing bytes, use redis.command_bin.
Bitmaps, GEO, and HyperLogLog
- Bitmaps:
SETBIT,GETBIT,BITCOUNT,BITPOS,BITOP, andBITFIELD/BITFIELD_ROoperate on the underlying String value inredis._string(redis._bitmaphelpers), preserving byte-exact compatibility withGETandSET. - GEO:
GEOADD,GEODIST,GEOHASH,GEOPOS,GEORADIUS,GEORADIUSBYMEMBER,GEOSEARCH, andGEOSEARCHSTOREstore 52-bit geohash integers as scores insideredis._zset. Radius and box queries, result limits,ASC/DESCordering, and destination key writes are supported; manually inserted scores outside the valid GEO domain differ from Redis in edge-case error reporting. - HyperLogLog:
PFADD,PFCOUNT, andPFMERGEstore the Redis 7.2.4 sparse and dense HLL representations inside String values (HYLLheader), soGETandSETcan read or restore raw HyperLogLog state directly.
Object operations
DUMPandRESTORE:DUMPserializes a single key in Redis RDB v11 payload format with a 64-bit CRC64 checksum, andRESTOREreconstructs the key (REPLACE,ABSTTL,IDLETIME,FREQ). They operate on individual keys and do not read or write whole-instance.rdbor AOF files; use PostgreSQL backup tools for database backups.OBJECTandDEBUG OBJECT:OBJECT ENCODINGreports the Redis-compatible encoding name (int,embstr,raw,listpack,hashtable,skiplist,stream).OBJECT IDLETIMEandOBJECT FREQrequirepg_redis.object_heat_tracking = on, and exact listpack/quicklist transition tracking requirespg_redis.list_layout_tracking = on(both default tooffso ordinary reads and list writes avoid extra metadata updates; see Compatibility).
3 - SQL API
The pg_redis extension exposes SQL functions in schema redis so PostgreSQL transactions, stored procedures, and triggers can execute Redis commands in the same transaction as relational tables. Every function returns wire-formatted RESP replies as bytea.
For step-by-step examples, see SQL rollback, Binary keys and values, and Transactional outbox.
Command functions
| Function | Arguments | Description |
|---|---|---|
redis.command(text[], integer DEFAULT 0) | Command and arguments as text[], followed by logical database number (0..15) | Executes one command and returns a RESP2 reply as bytea. |
redis.command_bin(bytea[], integer DEFAULT 0) | Command and arguments as bytea[], followed by logical database number (0..15) | Binary-safe entry point for NUL (\x00) bytes or non-UTF-8 payloads; returns a RESP2 reply as bytea. |
Calling redis.command invokes redis.command_bin internally, so the calling PostgreSQL role requires USAGE ON SCHEMA redis, EXECUTE on both functions, and EXECUTE on the required capability marker (redis._read(), redis._write(), or redis._admin()). See Authentication and permissions for the complete GRANT list.
Errors, savepoints, and transaction scope
- Shared transaction: Both functions execute inside the caller’s
READ COMMITTEDPostgreSQL transaction (REPEATABLE READandSERIALIZABLEare rejected). Even when invoked from a SQLSELECT, a mutating command such asSETwrites rows and requiresredis._write(). - SQLSTATE codes: Redis command errors (such as
WRONGTYPEor syntax errors) raise SQLSTATERD001. Commands blocked byCLIENT PAUSEraise SQLSTATERD002. PostgreSQL engine errors (such as deadlocks or constraint failures) retain their native PostgreSQL SQLSTATE codes. - Savepoint recovery: Because an unhandled
RD001aborts the current SQL transaction block, wrap fallible Redis calls in aSAVEPOINT(or a PL/pgSQLBEGIN ... EXCEPTION WHEN SQLSTATE 'RD001' THEN ... ENDblock) to recover without losing earlier SQL work. - Per-call database index: The
dbparameter applies only to that function call. ExecutingSELECTinsideredis.commanddoes not change the logical database for subsequent SQL calls.
Blocking and Pub/Sub session API
Ordinary SQL calls cannot hold a transaction open while waiting for another transaction to publish a message or push a list item. For blocking commands (BLPOP, BLMOVE, BZPOPMIN, XREAD BLOCK, XREADGROUP BLOCK, WAIT) and Pub/Sub subscriptions across multiple SQL transactions, use the session functions:
| Function | Positional parameters | Return value (bytea) |
|---|---|---|
redis.blocking_begin(bytea[], bytea, integer DEFAULT 0) | args, token, db=0 | Registers a blocking command with RESP2 reply encoding; returns a 2-element RESP2 array [flag, result]. |
redis.blocking_begin(bytea[], bytea, integer, integer) | args, token, db, protocol | Registers a blocking command with explicit reply protocol (2 or 3); returns [flag, result]. |
redis.blocking_poll(bytea, integer DEFAULT 0) | token, db=0 | Polls for completion and renews the lease; returns [flag, result]. |
redis.blocking_cancel(bytea, integer DEFAULT 0) | token, db=0 | Deletes the registration and returns +OK\r\n. |
redis.pubsub_open(bytea, integer DEFAULT 2) | token, protocol=2 | Opens a Pub/Sub session with protocol 2 or 3; returns +OK\r\n. |
redis.pubsub_change(bytea, bytea[]) | token, args | Applies a subscription command (SUBSCRIBE, UNSUBSCRIBE, PSUBSCRIBE, SSUBSCRIBE, etc.); returns [count, frames]. |
redis.pubsub_poll(bytea) | token | Dequeues pending messages in the current transaction; returns [count, frames]. |
redis.pubsub_cancel(bytea) | token | Closes the Pub/Sub session and deletes queued messages; returns +OK\r\n. |
Parameter and lifecycle rules:
tokenis a unique 32-bytebyteagenerated by the caller for each blocking wait or Pub/Sub session. All subsequentpoll,change, andcancelcalls must use the sameLOGINand active role.- For blocking operations,
[flag, result]hasflag = 0(with a null bulk string) while waiting, andflag = 1once fulfilled. Register withblocking_beginand commit first, then callblocking_pollin subsequent transactions. Repeated polls after completion return the fixed result without popping a second element. - For Pub/Sub,
pubsub_polldeletes delivered rows fromredis._pubsub_eventinside the caller’s transaction; rolling back that transaction restores the messages to the queue.
4 - Transactions and retries
SQL callers and Redis wire clients share the same PostgreSQL storage tables and WAL, but they enter transactions through different boundaries.
MULTI, EXEC, and WATCH
MULTI starts a command queue in the Go gateway. EXEC dispatches the queued commands inside a single PostgreSQL READ COMMITTED transaction. An idle MULTI or WATCH session on a client connection does not hold an open PostgreSQL transaction in the background.
| Condition | Behavior on EXEC |
|---|---|
| Unknown command or wrong arity while queuing | Queuing records the syntax error and EXEC aborts the queue with -EXECABORT Transaction discarded because of previous errors. |
Runtime command error inside EXEC (for example WRONGTYPE) | That slot in the EXEC array reply contains the error frame; sibling commands in the queue still execute and commit, matching Redis. |
Watched key modified before EXEC | EXEC returns a null array reply (*-1\r\n in RESP2, _\r\n in RESP3) and applies no changes. |
| PostgreSQL engine error (such as deadlock or out-of-workspace error) | The entire PostgreSQL transaction rolls back so no partial EXEC state persists. |
WATCHon existing and missing keys:WATCHregisters key digests inredis._watch. If another client creates and then deletes a watched missing key (or modifies a key and restores its previous value), row triggers record the revision change andEXECdetects the conflict.- Deterministic command time and wakeups: All commands inside one
EXECbatch share a single timestamp for key expiry checks. Blocked clients waiting on keys touched byEXECobserve the final committed state after the entire queue finishes.
SQL transactions
Multiple calls to redis.command and redis.command_bin inside BEGIN ... COMMIT join the caller’s outer SQL transaction:
- Relational table rows, Redis key mutations, and queued Pub/Sub / tracking / blocking notifications commit or roll back atomically. See the SQL rollback tutorial.
- Only
READ COMMITTEDtransaction isolation is supported. Callingredis.commandunderREPEATABLE READorSERIALIZABLEraises an explicit error because internal lock-wait re-reads require fresh statement snapshots. - Mixing SQL row locks and Redis key mutations across concurrent transactions in different orders can form a PostgreSQL deadlock. PostgreSQL aborts one participant with SQLSTATE
40P01; applications should handle deadlock retries at the transaction boundary.
Handling lost responses (UNKNOWN outcomes)
When a client sends a mutating command (INCR, LPOP, PUBLISH, XADD, EXEC) and the network connection drops or times out before the reply arrives, the PostgreSQL transaction may have already committed. Reconnecting and running PING only proves that the new socket works; it cannot reveal whether the previous write committed.
- Gateway behavior: When a connection becomes uncertain (read/write timeout, PostgreSQL link drop, or output buffer overflow), the gateway closes the client socket and retires the backend connection without automatically re-running the command.
- Client library retry pitfalls: Many Redis client libraries enable automatic command retries by default. In Linux acceptance tests (
aade9dfa0, 2026-10-15), a defaultredis-py6.4.0 client (which defaults to 3 retries) repeated anINCRafter a dropped reply and incremented the counter to2. SettingRetry(NoBackoff(), 0)sent the command once and raised a connection error, leaving the caller responsible for resolving theUNKNOWNstate. Even with zero connection retries,redis-py’sRedis.transaction()helper catchesWatchErrorand re-runs its callback when anEXECreply is lost. - Safe retry patterns: For non-idempotent operations, either disable automatic client retries and inspect application state before retrying, or record an idempotency key / outbox row in the same transaction (as shown in the Transactional outbox tutorial).
5 - Pub/Sub and keyspace events
pgredis implements Redis Pub/Sub channels (SUBSCRIBE, UNSUBSCRIBE, PUBLISH), pattern subscriptions (PSUBSCRIBE, PUNSUBSCRIBE), standalone sharded Pub/Sub (SSUBSCRIBE, SUNSUBSCRIBE, SPUBLISH), introspection (PUBSUB CHANNELS, PUBSUB NUMSUB, PUBSUB NUMPAT, PUBSUB SHARDCHANNELS, PUBSUB SHARDNUMSUB), and keyspace notifications (notify-keyspace-events).
Subscriptions and transactional delivery
- Commit-ordered registration: The gateway confirms
SUBSCRIBE,PSUBSCRIBE, orSSUBSCRIBEonly after PostgreSQL commits the subscription registration inredis._pubsub_session. AnyPUBLISHorSPUBLISHcommitted afterwards reaches the subscriber. - Transactional publishing: Because
PUBLISHinserts intoredis._pubsub_eventinside the publisher’s PostgreSQL transaction, rolling back a SQL transaction or abortingEXECdiscards any messages published inside that transaction. Publishing the same payload twice in committed transactions delivers two distinct messages. - Sharded Pub/Sub scope:
SSUBSCRIBE,SUNSUBSCRIBE, andSPUBLISHoperate within the standalone PostgreSQL database; they do not route messages across a Redis Cluster. - SQL session API: SQL callers use
redis.pubsub_open,redis.pubsub_change,redis.pubsub_poll, andredis.pubsub_cancel. Commit the subscription transaction before publishing from another connection.pubsub_polldeletes delivered messages in its own transaction, and a rollback restores them.
Keyspace notifications
CONFIG SET notify-keyspace-events <flags> enables keyspace (__keyspace@<db>__:<key>) and keyevent (__keyevent@<db>__:<event>) notifications across all 16 logical Redis databases in the current PostgreSQL database (requires redis._admin() capability):
- Changes to
notify-keyspace-eventsand emitted notifications participate in SQL transactions andMULTI/EXECcommit or rollback. - Notifications reflect committed database mutations; they do not prove that a subscriber socket finished reading the frame.
- When a key with a TTL expires, read queries hide the key immediately at
expires_at <= clock_timestamp(), while theexpiredkeyspace notification is emitted when either a foreground command or the background maintenance worker physically deletes the expired row. See Expiry and session lifecycle.
Backpressure and session limits
Pub/Sub sessions and queued messages in redis._pubsub_session and redis._pubsub_event are bounded by admission limits:
| Resource | Default limit |
|---|---|
| Session lease TTL | 120 seconds |
| Queued message payload per client | 1 MiB |
| Queued message frames per client | 1,024 |
| Total retained Pub/Sub payload across sessions | 64 MiB |
| Active Pub/Sub sessions | 4,096 |
| Total subscription registrations | 16,384 |
Additionally, CONFIG SET client-output-buffer-limit enforces pubsub class hard and soft buffer limits (default 32 MiB hard, 8 MiB soft for 60 seconds; see Configuration). When a slow or stalled subscriber exceeds its queue or output buffer limit, pg_redis marks the route failed, logs a pg_redis Pub/Sub route failure decision entry in the PostgreSQL server log, and the gateway closes the client connection. Disconnected clients must reconnect and re-subscribe; Pub/Sub subscriptions and unread queues are transient session state and are not restored across server restarts or pg_dump backups.
6 - Streams and consumer groups
A Redis Stream stores append-only entries ordered by a two-part identifier (milliseconds-sequence). Each entry contains an ordered list of binary field/value pairs. Consumer groups allow multiple workers to partition a stream, track unacknowledged work in a Pending Entries List (PEL), and transfer stalled entries.
For an end-to-end transactional example combining SQL tables with Redis Streams, see the Transactional outbox tutorial.
Entries, IDs, and trimming
- Full 128-bit ID domain: Stream IDs consist of two unsigned 64-bit integers (
ms-seq).pgredispreserves the fulluint64range for both components insideredis._stream. - Entry payload fidelity: Field/value pairs retain their exact insertion order, duplicate field names within the same entry, and arbitrary binary bytes (including
NUL). - Write, read, and trim commands: Use
XADDto append entries (NOMKSTREAM,MAXLEN,MINID),XRANGEandXREVRANGEto query ID intervals (-,+, exclusive(bounds,COUNT),XLENto read the entry count, andXDELorXTRIMto remove entries. - Approximate trimming and
XSETID: Approximate trimming (MAXLEN ~orMINID ~) follows internal stream node boundaries configured bystream-node-max-entriesandstream-node-max-bytes, so it may retain more entries than the requested threshold.XSETIDupdates stream metadata (last_generated_id,entries_added,max_deleted_entry_id) without inserting an entry or waking blocked readers.
Consumer groups and pending entries
- Group lifecycle:
XGROUP CREATE(MKSTREAM,ENTRIESREAD),XGROUP SETID,XGROUP DESTROY,XGROUP CREATECONSUMER, andXGROUP DELCONSUMERmanage consumer group state inredis._stream_group. - Reading and acknowledging:
XREADGROUP GROUP <group> <consumer> ... STREAMS <key> >delivers new entries and records them inredis._stream_pelunlessNOACKis specified.XACKremoves acknowledged entries from the PEL. - Inspecting and claiming stalled work:
XPENDINGinspects unacknowledged entries by ID range, idle time (IDLE), and consumer.XCLAIMandXAUTOCLAIMtransfer ownership of pending entries to another consumer and increment delivery counters. - Deleted entries in the PEL: If an entry is deleted with
XDELwhile still referenced inredis._stream_pel, historicalXREADGROUP(0) orXCLAIMcalls return a nil/empty payload for that ID, matching Redis 7.2.4. Known gaps inv0.1.0-rc1:XINFO GROUPScomputeslagfrom stream length rather than adjusting forXDEL, andXAUTOCLAIMhas one cursor formatting difference when draining an empty queue (99/101inunit/type/stream-cgroups; see Status).
Blocking reads
- RESP connections:
XREAD BLOCK <ms>andXREADGROUP BLOCK <ms>wait for matchingXADDcommits. InsideMULTI/EXEC,BLOCKoptions run non-blockingly as immediate reads; external clients blocked on a stream wake only after anEXECbatch or SQL transaction commits. - SQL transactions: Ordinary
redis.commandcalls cannot block and commit a caller’s transaction while waiting. SQL callers useredis.blocking_begin,redis.blocking_poll, andredis.blocking_cancelacross transactions. - Restart behavior: Stream entries, consumer group offsets (
last_delivered_id), and PEL records persist in PostgreSQL WAL and survive restarts andpg_dump/pg_restore, whereas activeBLOCKnetwork waits are transient and require clients to reconnect.
7 - Configuration
Configuration is split between command-line flags on the pgredis Go gateway executable (cmd/pgredis/main.go) and database-level settings managed by PostgreSQL and the pg_redis extension (v0.1.0-rc1, schema 0.54, commit 11411411d72ab45456904cc602cefbb13b68ff25).
Gateway CLI flags
| Flag | Default | Description |
|---|---|---|
-listen | 127.0.0.1:56379 | RESP listener address (Mimus assigns 6379 in standard deployments). |
-pg | postgres://127.0.0.1:55432/pgredis?sslmode=disable | PostgreSQL connection URL without credentials. |
-auth-mode | native | Authentication mode: native (PostgreSQL roles) or redis-acl (redis._acl_user). |
-acl-service-user | (empty) | Bound PostgreSQL LOGIN role used when -auth-mode redis-acl is active. |
-acl-service-password-file | (empty) | File containing the ACL service role password (one trailing newline stripped); falls back to PGREDIS_ACL_SERVICE_PASSWORD. |
-default-user | app | PostgreSQL LOGIN role used for single-argument AUTH <password> in native mode. |
-client-default-resp | 2 | Initial wire protocol for new connections and RESET (2 or 3). |
-max-clients | 1024 | Maximum concurrent RESP client connections. |
-max-pools | 8 | Maximum cached PostgreSQL identity connection pools. |
-pool-size | 4 | Maximum PostgreSQL backend connections per identity pool (1..2147483647). |
-tls-cert | (empty) | Server TLS certificate path (required when -listen is non-loopback). |
-tls-key | (empty) | Server TLS private key path (required when -listen is non-loopback). |
-max-bulk-bytes | 536870912 (512 MiB) | Maximum bytes for a single request bulk argument. |
-max-frame-bytes | 1074790400 (1 GiB + 1 MiB) | Maximum sum of argument bytes in a single request frame. |
-max-reply-bytes | 1074790400 (1 GiB + 1 MiB) | Maximum wire bytes for a complete reply, including EXEC child replies. |
-max-input-bytes | 2147483648 (2 GiB) | Shared budget across connections for live input payloads and bookkeeping. |
-max-output-bytes | 2147483648 (2 GiB) | Shared budget across connections for live replies, workspace, and bookkeeping. |
-max-pg-read-bytes | 2147483648 (2 GiB) | Shared budget for PostgreSQL receive buffers and DataRow metadata. |
-max-pg-message-bytes | 1073741822 (1 GiB - 2 B) | Maximum bytes in a single PostgreSQL wire message body. |
-frame-read-timeout | 30s | Deadline to finish reading a frame after its first byte arrives. |
-command-timeout | 30s | Per-command execution timeout against PostgreSQL. |
-write-timeout | 10s | Deadline for writing a reply frame to the client socket. |
-tls-handshake-timeout | 5s | Deadline for completing a client TLS handshake. |
-version | false | Print pgredis 0.1.0 and exit. |
The -pg URL must never contain a password. In native mode, clients supply their PostgreSQL role credentials via AUTH or HELLO ... AUTH. In redis-acl mode, the gateway connects with -acl-service-user and verifies per-user hashes inside redis._acl_user.
Connection pools and default protocol
- Identity-isolated pools: The gateway isolates connection pools by database and authenticated principal (
-max-pools 8,-pool-size 4). Active checkout references prevent pool eviction, and up to 4 additional short-lived connections are permitted for credential verification. Connections return to a pool only after transaction state and session state (redis._pool_reset()) are cleanly reset; any uncertain connection is closed immediately. - Default RESP version:
-client-default-resp 3starts new connections in RESP3 mode instead of RESP2.HELLO 2orHELLO 3switches the active connection protocol,AUTHpreserves it, andRESETrestores the gateway’s-client-default-respdefault.
PostgreSQL extension GUCs
Configure these PostgreSQL GUCs in postgresql.conf (or with ALTER DATABASE ... SET as a superuser):
| GUC | Default | Context | Description |
|---|---|---|---|
pg_redis.maintenance_database | 'postgres' | postmaster (shared_preload_libraries) | Target database where the background maintenance worker reclaims expired keys and leases. |
pg_redis.maintenance_role | 'postgres' | postmaster (shared_preload_libraries) | PostgreSQL role used by the background maintenance worker. |
pg_redis.object_heat_tracking | off | superuser | When on, every key access updates LRU/LFU metadata in redis._object_heat so OBJECT IDLETIME and OBJECT FREQ report live values (causing plain reads to write WAL). |
pg_redis.list_layout_tracking | off | superuser | When on, newly created Lists track exact Redis listpack/quicklist encoding transitions on every write. |
Redis CONFIG GET and CONFIG SET
pg_redis persists selected Redis runtime settings inside PostgreSQL tables so they participate in SQL transactions, savepoints, and pg_dump backups:
| Parameter | Default | Backing table | Effect |
|---|---|---|---|
notify-keyspace-events | "" (disabled) | redis._config | Enables keyspace (K) and keyevent (E) Pub/Sub notifications. |
slowlog-log-slower-than | 10000 (10 ms) | redis._slowlog_config | Microsecond threshold for recording entries in redis._slowlog (negative disables). |
slowlog-max-len | 128 | redis._slowlog_config | Maximum retained slowlog entries. |
latency-tracking-info-percentiles | "50 99 99.9" | redis._slowlog_config | Space-separated percentile list formatted in INFO latencystats. |
acllog-max-len | 128 | redis._acl_config | Maximum entries retained in redis._acl_log for ACL LOG. |
requirepass | "" | redis._acl_config | Password for the Redis default ACL user (does not alter PostgreSQL LOGIN roles). |
acl-pubsub-default | "resetchannels" | redis._acl_config | Default Pub/Sub channel policy (resetchannels or allchannels) for new ACL users and RESET. |
tracking-table-max-keys | 1000000 | redis._tracking_config | Maximum tracked keys in redis._tracking_key before earlier entries are evicted and invalidated. |
client-output-buffer-limit | "normal 0 0 0 slave 268435456 67108864 60 pubsub 33554432 8388608 60" | redis._output_config | Per-class <hard> <soft> <seconds> output buffer limits (replica is accepted as an alias for slave). |
hash-max-listpack-entries, hash-max-listpack-value, list-max-listpack-size, list-compress-depth, set-max-intset-entries, set-max-listpack-entries, set-max-listpack-value, zset-max-listpack-entries, zset-max-listpack-value, stream-node-max-bytes, stream-node-max-entries | Redis 7.2.4 defaults | redis._config | Thresholds used for OBJECT ENCODING reporting and approximate XTRIM node boundaries. |
Client output buffer limits and route logs
client-output-buffer-limitaccounting:normallimits apply to ordinary,MONITOR, and tracking-only connections (0 0 0disabled by default);pubsublimits apply to subscribed connections (32 MiBhard,8 MiBsoft for60seconds by default). Accounting sums retained Go reply bytes plus unread rows inredis._pubsub_eventor theMONITORring. Exceeding a hard or sustained soft limit closes the connection without sending an extra error frame.- Server-side route failure log: When a Pub/Sub or tracking route fails a capacity, message-count, single-message-size, or identity check,
pg_rediswrites apg_redis Pub/Sub route failure decisionmessage to the PostgreSQL server log containing the failure reason, database OID, XID, and tuple position, while omitting tokens, channel names, and payloads.
8 - Limits
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
| Resource | Flag | Default limit |
|---|---|---|
| Single bulk argument | -max-bulk-bytes | 512 MiB (536,870,912 bytes) |
| Total argument bytes in one request frame | -max-frame-bytes | 1 GiB + 1 MiB (1,074,790,400 bytes) |
Unauthenticated request header (AUTH pending) | Built-in | 10 arguments, 16,384 bytes per bulk argument |
Complete wire reply (including EXEC array) | -max-reply-bytes | 1 GiB + 1 MiB (1,074,790,400 bytes) |
| Shared live input payload and bookkeeping | -max-input-bytes | 2 GiB (2,147,483,648 bytes) |
| Shared live output payload and workspace | -max-output-bytes | 2 GiB (2,147,483,648 bytes) |
| Shared PostgreSQL receive buffer budget | -max-pg-read-bytes | 2 GiB (2,147,483,648 bytes) |
| Single PostgreSQL wire message body | -max-pg-message-bytes | 1 GiB - 2 B (1,073,741,822 bytes) |
- Local
pgxread-budget patch: Duringmake build,scripts/prepare_pgx.pyappliespatches/pgx-v5.11.0-read-budget.patchto the Go driver so oversized PostgreSQL wire messages and shared-max-pg-read-bytesbudgets 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-bytesor-max-output-bytes. Callers that lose a connection or receive an output-budget error must treat the write outcome asUNKNOWN.
Extension workspace and session limits
| Component | Default limit | Behavior when exceeded |
|---|---|---|
| Per-backend C workspace and reply budget | 2 GiB | Raises a PostgreSQL error and rolls back the statement or savepoint. |
Shared preload memory budget (shared_preload_libraries) | 2 GiB | Bounds shared allocations across backends. |
MONITOR shared-memory ring | 4 MiB / 4,096 entries | Drops stalled MONITOR cursors that fall behind the ring head. |
| Pub/Sub queue per client | 1 MiB / 1,024 frames | Marks the session failed and closes the subscriber connection. |
| Total retained Pub/Sub payload | 64 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 overflowbigintis 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.