# PUBSUB SHARDNUMSUB

> Return the number of subscribers of each given shard channel.

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

```
PUBSUB SHARDNUMSUB [shardchannel [shardchannel ...]]
```

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

`PUBSUB SHARDNUMSUB` returns, for each shard channel you name, how many
connections on this node subscribe to it with
[SSUBSCRIBE](https://docs.hotkv.com/commands/ssubscribe/index.md). Without channels it returns an empty
array.

## Return value

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

## Examples

```
127.0.0.1:6379> PUBSUB SHARDNUMSUB orders:{eu} orders:{us}
1) "orders:{eu}"
2) (integer) 1
3) "orders:{us}"
4) (integer) 0
```

## Compatibility

Same as Redis 7 and Valkey 8.

## See also

[PUBSUB SHARDCHANNELS](https://docs.hotkv.com/commands/pubsub-shardchannels/index.md),
[PUBSUB NUMSUB](https://docs.hotkv.com/commands/pubsub-numsub/index.md), [SPUBLISH](https://docs.hotkv.com/commands/spublish/index.md)