PUBSUB-NUMPAT(3valkey)

πŸ“¦
version 9.0.6 Β· 2 versions
, in fedora 44

✨ PUBSUB-NUMPAT πŸ’…

okay bestie, welcome to the Valkey Command Manual page for pubsub-numpat β€” yes, it's a (3valkey) situation, we're fancy like that πŸŽ€


🌸 NAME 🌸

pubsub-numpat β€” counts up all the unique pattern subscriptions for you. that's the whole job. it's giving "one thing, done perfectly" πŸ‘‘


πŸ¦‹ SYNOPSIS πŸ¦‹

PUBSUB NUMPAT

literally that's it. no arguments, no drama, no options. iconic behavior fr fr ✨


πŸ’– DESCRIPTION πŸ’–

so it returns the number of unique patterns that clients are subscribed to β€” and those subscriptions happen via the valkey-psubscribe(7) PSUBSCRIBE command, iykyk 🧚

⚠️ and listen, because this trips people up: this is NOT the count of clients subscribed to patterns. nope. it's the total number of unique patterns that all the clients are subscribed to. so if a hundred besties all subscribe to the same pattern, that's still just one pattern. periodt πŸ’…

Cluster note: in a Valkey Cluster, clients can subscribe to every node, and can also publish to every other node too. the cluster will make sure that published messages get forwarded wherever they need to go 🌈 that said β€” and this is the important bit β€” the replies from valkey-pubsub(7) PUBSUB in a cluster only report information from the node's own Pub/Sub context, not the entire cluster. so don't come for the numbers expecting the whole cluster's tea, because you will not get it 😭


πŸŽ€ REPLY πŸŽ€

valkey-protocol(7) Integer reply: the number of patterns all the clients are subscribed to. a nice clean integer, no crumbs πŸ“


πŸ”₯ COMPLEXITY πŸ”₯

O(1)

constant time, always. fastest girl in the room, no cap ⭐


πŸ‘‘ ACL CATEGORIES πŸ‘‘

@pubsub @slow


🌈 HISTORY 🌈

  • Available since: 2.8.0

she's been here since 2.8.0 and she's been serving ever since πŸ’œ


πŸ’€ SEE ALSO πŸ’€


and that's the whole page bestie 🫢 go count those patterns, stay hydrated, and remember: it's unique patterns, not unique clients, and in a cluster you only see your own node's business πŸ™ˆ

this has been the Valkey Command Manual, version 9.0.0, dated 2025-10-21 β€” mwah πŸ’–

πŸ“¦ where this page comes from