---
title: count_min_sketch() | Tiger Data Docs
description: Aggregate data into a `CountMinSketch` for approximate counting
---

Early access [1.8.0](https://github.com/timescale/timescaledb-toolkit/releases/tag/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.

## Arguments

The syntax is:

```
count_min_sketch(
    values TEXT,
    error DOUBLE PRECISION,
    probability DOUBLE PRECISION,
) RETURNS CountMinSketch
```

| Name          | Type             | Default | Required | Description                                                                                  |
| ------------- | ---------------- | ------- | -------- | -------------------------------------------------------------------------------------------- |
| `values`      | TEXT             | -       | ✔        | The column of values to count                                                                |
| `error`       | DOUBLE PRECISION | -       | ✔        | Error tolerance in estimate, calculated relative to the number of values added to the sketch |
| `probability` | DOUBLE PRECISION | -       | ✔        | Probability that an estimate falls outside the error bounds                                  |

## Returns

| Column             | Type           | Description                           |
| ------------------ | -------------- | ------------------------------------- |
| `count_min_sketch` | CountMinSketch | An object storing a table of counters |
