# PUBSUB NUMSUB

> Return the number of subscribers of each given channel.

URL: https://docs.hotkv.com/commands/pubsub-numsub/

```
PUBSUB NUMSUB [channel [channel ...]]
```

- Group: Pub/Sub
- Complexity: O(N) for N channels
- HotKV Cloud: all plans
- On-Premise: no license needed

`PUBSUB NUMSUB` returns, for each channel you name, how many connections on
this node subscribe to it with [SUBSCRIBE](https://docs.hotkv.com/commands/subscribe/index.md). Pattern
subscriptions are not counted. Without channels it returns an empty array.

## Return value

| Case | RESP2 | RESP3 |
| --- | --- | --- |
| Always | Flat array of channel, count pairs, in the order given | Same flat array |

## Examples

```
127.0.0.1:6379> PUBSUB NUMSUB news alerts quiet
1) "news"
2) (integer) 2
3) "alerts"
4) (integer) 1
5) "quiet"
6) (integer) 0
```

## Compatibility

Same as Redis 7 and Valkey 8.

## See also

[PUBSUB CHANNELS](https://docs.hotkv.com/commands/pubsub-channels/index.md),
[PUBSUB SHARDNUMSUB](https://docs.hotkv.com/commands/pubsub-shardnumsub/index.md),
[PUBSUB](https://docs.hotkv.com/commands/pubsub/index.md)