> ## Documentation Index
> Fetch the complete documentation index at: https://learn.kubit.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Sampling

> Sample Kubit reports by events or by subjects to get results from very large queries, and how sampling works in Query, Funnel, Retention, Path and Cohorts.

Sampling runs a report on a random part of the data instead of all of it. Kubit samples in two ways, by events or by subjects. This page covers the two methods, when to sample, where the sampling rate is set and how sampling works in each report type.

## When to use

| Use case | Example |
| - | - |
| A query exceeds the timeout | A report over several years of events that doesn't finish in 15 minutes |
| Very large populations | A funnel over 100 million or more users |
| An estimate is enough | A 20% sample answers the question as well as the full data set |

## Sampling methods

Kubit samples either by events or by subjects.

![Diagram of a population of people with five of them circled and moved into a smaller sample group.](https://mintcdn.com/kubit/9i8QHxqek50tMBGy/images/reports/common/sampling-population-diagram.png?fit=max\&auto=format\&n=9i8QHxqek50tMBGy\&q=85\&s=9bbf518130b2317ecd5472a0b30bc18f)

### Sample by events

Event sampling takes a random sample of events, regardless of the user, session or device that performed them. Use it when you want to sample by the number of times an event happened.

**Availability:** Event sampling is available only on Snowflake. Other cloud warehouses either don't support it or would run it with severe performance penalties.

### Sample by subjects

Subject sampling takes a random sample of subjects (such as User ID or Session ID) and returns every event each sampled subject performed. Subjects are specific to your Kubit workspace. Because every sampled subject keeps all its events, results stay complete across the steps of a Funnel or Retention analysis.

**Availability:** Subject sampling is available on every warehouse.

Subject sampling is most often used in Funnel, Retention, Path and Cohort reports.

## Why sample

Most reports don't need sampling. Sample when a query returns so many rows that it doesn't finish within the **15-minute** query timeout.

If you query a very long period (years) or a very large number of events or users (100 million or more), sample so the report returns results. Sampling also helps when an approximate answer is enough, for example when a 20% sample is accurate enough for the question.

## Set the sampling rate

Every report has a sampling rate control at the bottom of the report builder, to the left of **Execute**. Pick a rate from the list, or type your own value.

![Funnel report builder with the Sampling Rate list open next to Execute, offering 1%, 5%, 10%, 50% and 100%, with a custom value of 35 typed in.](https://mintcdn.com/kubit/9i8QHxqek50tMBGy/images/reports/common/sampling-rate-control.png?fit=max\&auto=format\&n=9i8QHxqek50tMBGy\&q=85\&s=9043a8d0105dfd23c1500e90c9552e24)

### MCP prompt examples

> "Show the signup funnel for the last 2 years at a 10% sampling rate"

## Sampling in Query and Data Table

In Query and Data Table reports, every measure function uses event sampling. Results cover only the sampled percentage of all events. If events are evenly distributed, a sampled metric can be very close to the metric from the full data set.

For example, at a 25% sampling rate:

| Query measure | 100% results | 25% sampled results |
| - | - | - |
| Count Events: Any Event | 100,000 events | 25,000 events |
| Unique Users: Any Event | 3,500 users | About 875 users, depending on how users are spread across events |

Histogram and Impact Analysis in Query target a subject, so they use subject sampling instead. The sampled percentage of unique subjects (such as users) is selected from the event data.

## Sampling in Funnel, Retention and Path

In Funnel, Retention and Path reports, the sampling rate applies to the subject you select. Kubit uses consistent hashing of the subject ID (such as `user_id`), so the same users are analyzed in every step. The same applies to Query in Histogram or Impact mode.

Results cover only the sampled percentage of subjects. If events are evenly distributed, a sampled metric can be very close to the metric from the full data set.

For example, a Funnel on User ID at a 50% sampling rate:

| Step event | 100% results | 100% conversion rate | 50% results | 50% conversion rate |
| - | - | - | - | - |
| Login | 100,000 | 100% | About 50,000 | 100% |
| View Home | 30,000 | 30% | About 15,000 | 30% |
| Add to Cart | 10,000 | 33% | About 5,000 | 33% |
| Purchase | 5,000 | 50% | About 2,500 | 50% |

The conversion rates stay the same, because Kubit samples users, not step events.

## Sampling in Cohorts

Cohort features that need a subject (Group By cohort, cohort filters and the cohort builder) use consistent hashing of the subject ID, such as `user_id`.

### Group By cohort and cohort filter

When a report uses a cohort, you can set a sampling rate to reduce the number of subjects in it. This can cut query time significantly.

![Create New Cohort dialog for users who performed an event at least once, with the cohort sampling rate list open showing 1%, 5%, 10%, 50% and 100%.](https://mintcdn.com/kubit/9i8QHxqek50tMBGy/images/reports/common/sampling-cohort-group-by.png?fit=max\&auto=format\&n=9i8QHxqek50tMBGy\&q=85\&s=bcf1c7ac546a16b547d6ddbe4af482c4)

### Inspect

When you inspect a cohort, you can set a sampling rate to reduce how much data comes back.

![Cohort page with Data Range for Sampling set to Last 1 day and the Sampling Rate list open, with Percentage and Absolute tabs and rates from 1% to 100%.](https://mintcdn.com/kubit/9i8QHxqek50tMBGy/images/reports/common/sampling-cohort-inspect.png?fit=max\&auto=format\&n=9i8QHxqek50tMBGy\&q=85\&s=cc55096838f1589c5dfacd9c26d19e22)

## Related

* [Cohorts](https://learn.kubit.ai/product-analytics/reports/cohorts.md): build and inspect cohorts.
* [Funnel](https://learn.kubit.ai/product-analytics/reports/funnel.md): the report where subject sampling keeps conversion rates intact.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.