CMS.INITBYDIM

CMS.INITBYDIM key width depth [CELL_SIZE cell_size]
Available in:
Redis Open Source / Bloom 2.0.0
Time complexity:
O(1)
ACL categories:
@cms, @write, @fast,
Compatibility:
Redis Software and Redis Cloud compatibility

Initializes a Count-Min Sketch to dimensions specified by user.

Required arguments

key

The name of the sketch.

width

Number of counters in each array. Reduces the error size.

depth

Number of counter-arrays. Reduces the probability for an error of a certain size (percentage of total count).

Optional arguments

CELL_SIZE cell_size

The size, in bytes, of each counter in the sketch. Valid values are 1, 2, 4, or 8. A smaller cell size reduces memory usage but lowers the maximum count a cell can hold before overflowing. A larger cell size supports higher counts at the cost of more memory. Default is 4.

Examples

redis> CMS.INITBYDIM test 2000 5
OK
redis> CMS.INITBYDIM test2 2000 5 CELL_SIZE 1
OK

Redis Software and Redis Cloud compatibility

Redis
Software
Redis
Cloud
Notes
✅ Supported
✅ Flexible & Annual
✅ Free & Fixed

Return information

One of the following:

RATE THIS PAGE
Back to top ↑