# CMS.QUERY

> Return the estimated counts of one or more items in a Count-min sketch.

URL: https://docs.hotkv.com/commands/cms-query/

```
CMS.QUERY key item [item ...]
```

- Group: Count-min sketch
- Complexity: O(n * depth), n being the items
- HotKV Cloud: all plans
- On-Premise: no license needed

`CMS.QUERY` returns the estimated count of each `item` in the Count-min sketch
at `key`. An estimate is never below the item's true count, and can be above
it. Items never counted usually report `0`.

## Return value

An array with one integer per item, the same in RESP2 and RESP3.

Error replies: `CMS: key does not exist`, and `WRONGTYPE` if the key holds
another type.

## Examples

```
127.0.0.1:6379> CMS.INITBYDIM pageviews 2000 5
OK
127.0.0.1:6379> CMS.INCRBY pageviews /home 5 /pricing 1
1) (integer) 5
2) (integer) 1
127.0.0.1:6379> CMS.QUERY pageviews /home /pricing /blog
1) (integer) 5
2) (integer) 1
3) (integer) 0
```

## Compatibility

Same as `CMS.QUERY` in RedisBloom.

## See also

[CMS.INCRBY](https://docs.hotkv.com/commands/cms-incrby/index.md), [CMS.INFO](https://docs.hotkv.com/commands/cms-info/index.md), [CMS.MERGE](https://docs.hotkv.com/commands/cms-merge/index.md)