Skip to content

count_min_sketch()

Aggregate data into a `CountMinSketch` for approximate counting

Early access 1.8.0

Aggregate data into a CountMinSketch object, which you can use to estimate the number of times a given item appears in a column. The sketch produces a biased estimator of frequency. It might overestimate the item count, but it can’t underestimate.

You can control the relative error and the probability that the estimate falls outside the error bounds.

The syntax is:

count_min_sketch(
values TEXT,
error DOUBLE PRECISION,
probability DOUBLE PRECISION,
) RETURNS CountMinSketch
NameTypeDefaultRequiredDescription
valuesTEXT-The column of values to count
errorDOUBLE PRECISION-Error tolerance in estimate, calculated relative to the number of values added to the sketch
probabilityDOUBLE PRECISION-Probability that an estimate falls outside the error bounds
ColumnTypeDescription
count_min_sketchCountMinSketchAn object storing a table of counters