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.

HKEYS

Last updated
HKEYS key
Group
Hash
Complexity
O(N) where N is the size of the hash
Arity
2 (exactly, counting the command name)
Flags
read-only
Keys
first 1, last 1, step 1
HotKV Cloud
All plans
On-Premise
no license needed

HKEYS returns every field name in the hash stored at key. The order is not defined. For large hashes, prefer HSCAN so a single reply does not carry the whole hash.

Case RESP2 RESP3
Hash exists Array of bulk strings: the field names Same
Key does not exist Empty array Same

HKEYS replies with a WRONGTYPE error if key holds a value that is not a hash.

127.0.0.1:6379> HSET user:1 name "Ada" lang "en"
(integer) 2
127.0.0.1:6379> HKEYS user:1
1) "name"
2) "lang"
127.0.0.1:6379> HKEYS nosuchkey
(empty array)

Same as Redis 7.4 and Valkey 8.

HVALS, HGETALL, HSCAN, HLEN