Skip to content

Ask the HotKV docs

Answers come only from these docs and can be wrong; check the linked pages before you rely on them.

OBJECT ENCODING

Last updated
OBJECT ENCODING key
Group
Keys
Complexity
O(1)
Arity
3 (exactly, counting the command name)
HotKV Cloud
All plans
On-Premise
no license needed

OBJECT ENCODING returns the name of the encoding used for the value at key. Small collections use a compact encoding and switch to a general one once they grow past the configured size limits; tools written for Redis that check these names keep working.

Type Possible encodings
String int (a 64-bit integer), embstr, raw
List listpack, quicklist
Set intset, listpack, hashtable
Hash listpack, listpackex (compact, with field expiry), hashtable
Sorted set listpack, skiplist
Stream stream
Bloom filter, count-min sketch, Top-K raw

Looking at a key with OBJECT is not an access to it.

Case RESP2 RESP3
The key exists Bulk string: the encoding name Bulk string
The key does not exist Nil bulk string Null
127.0.0.1:6379> SET counter 12345
OK
127.0.0.1:6379> OBJECT ENCODING counter
"int"
127.0.0.1:6379> SET name "ada"
OK
127.0.0.1:6379> OBJECT ENCODING name
"embstr"
127.0.0.1:6379> SADD ids 1 2 3
(integer) 3
127.0.0.1:6379> OBJECT ENCODING ids
"intset"
127.0.0.1:6379> OBJECT ENCODING missing
(nil)

Same encoding names as Redis 7.4. The probabilistic types report raw.

OBJECT, TYPE, OBJECT FREQ