PUBSUB-NUMPAT(3valkey)
β¨ 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 π₯
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 π
psubscribe(3valkey)publish(3valkey)pubsub(3valkey)pubsub-channels(3valkey)pubsub-help(3valkey)pubsub-numsub(3valkey)pubsub-shardchannels(3valkey)pubsub-shardnumsub(3valkey)punsubscribe(3valkey)spublish(3valkey)ssubscribe(3valkey)subscribe(3valkey)sunsubscribe(3valkey)unsubscribe(3valkey)
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
- fedora 44: valkey-doc 9.0.3-2.fc44 Β· CC-BY-SA-4.0
- fedora 44: valkey-doc 9.0.6-1.fc44 Β· CC-BY-SA-4.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms