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

# Sampling

> Sampling speeds up audience and trait previews by materializing a small subset of your schema models into your warehouse. It changes previews only, not the full audience Hightouch evaluates when a sync or journey runs.

## Before you begin

* A defined [data schema](https://docs.hightouch.com/customer-studio/schema.md)
* Warehouse [source](https://docs.hightouch.com/getting-started/concepts.md#sources) with write permissions
* [Lightning sync engine](https://docs.hightouch.com/syncs/lightning-sync-engine.md) enabled

## When to use sampling

You don't need sampling for every schema. Enable it when previewing audiences or traits against your full dataset is too slow, or uses more warehouse compute than you want during interactive building.

Sampling is worth turning on when:

* your parent or related models hold very large datasets
* marketers wait too long for audience or trait previews
* interactive previews consume significant warehouse compute

It gives marketers a faster way to explore audience logic before running it against the full dataset.

> [!NOTE]
>
> A sampled preview is an approximation. Use it to iterate on audience logic,
> not to read an exact final count.

## How it works

Sampling creates smaller copies of your schema models as dedicated tables in your warehouse, then queries those when generating previews:

1. A configurable percentage of rows is sampled from your [parent model](https://docs.hightouch.com/customer-studio/schema.md#create-the-parent-model).
2. For each sampled parent row, the corresponding rows in [related](https://docs.hightouch.com/customer-studio/schema.md#add-a-related-model) and [event models](https://docs.hightouch.com/customer-studio/schema.md#add-an-event-model) are also materialized.
3. The sampled tables are stored in the [Hightouch Planner](https://docs.hightouch.com/syncs/lightning-sync-engine.md#warehouse-schemas) schema of your warehouse.
4. Sampling runs on a configurable schedule in the background.

Because each sampled child row ties back to a sampled parent row, previews for [traits](https://docs.hightouch.com/customer-studio/traits.md) and [audiences](https://docs.hightouch.com/customer-studio/usage.md) can still evaluate relationships while querying far less data.

> [!NOTE]
>
> Sampling requires write access to your warehouse and only works if the
> Lightning sync engine is enabled.

## Supported warehouses

Sampling is supported on the following sources:

* [Amazon Redshift](https://docs.hightouch.com/sources/amazon-redshift.md)
* [Databricks](https://docs.hightouch.com/sources/databricks.md)
* [Fabric](https://docs.hightouch.com/sources/fabric.md)
* [Google BigQuery](https://docs.hightouch.com/sources/google-bigquery.md)
* [Microsoft SQL Server](https://docs.hightouch.com/sources/sqlserver.md)
* [PostgreSQL](https://docs.hightouch.com/sources/postgresql.md)
* [Snowflake](https://docs.hightouch.com/sources/snowflake.md)
* [Trino](https://docs.hightouch.com/sources/trino.md)

The sampled tables are materialized in the [Hightouch Planner schema](https://docs.hightouch.com/syncs/lightning-sync-engine.md#warehouse-schemas).

## Set up sampling

Configure sampling from the parent model whose audiences and traits you want to preview.

1. Open a [parent model](https://docs.hightouch.com/customer-studio/schema.md#create-the-parent-model) in your schema.
2. Go to the **Sampling** tab.
3. Toggle sampling **on**.

| Disabled | Enabled |
| :-: | :-: |
| ![Enabling sampling in the Hightouch UI](https://mintcdn.com/hightouch-3c037897/L_vQfA0JQEpeGUUo/images/sampling/disabled.png?fit=max\&auto=format\&n=L_vQfA0JQEpeGUUo\&q=85\&s=cadacef53ed49ea7d49691032d1ec2bb) | ![](https://mintcdn.com/hightouch-3c037897/L_vQfA0JQEpeGUUo/images/sampling/enabled.png?fit=max\&auto=format\&n=L_vQfA0JQEpeGUUo\&q=85\&s=96f34560885c149cc11d0e4c312edf59) |

4. Configure the settings, then select **Save & run sampling**:

* **Sample size** — The percentage of your parent model (and any related models) that gets sampled.
* **Sample frequency** — How often the models get resampled. This schedule also applies to related models unless you override it.
* **Related models** — Lists the related and event models. Select the checkbox next to each related model you want to sample.

By default, each related model inherits the parent model's sampling schedule. Override it only when a related model needs a different refresh frequency.

![Related models table](https://mintcdn.com/hightouch-3c037897/L_vQfA0JQEpeGUUo/images/sampling/related-sampling.png?fit=max\&auto=format\&n=L_vQfA0JQEpeGUUo\&q=85\&s=b376b9aa6958ae71d491845800ce306f)

### Check the latest sampling run

The **Last run** table shows the status of the most recent run for each sampled model. If a run failed, hover over the status to see the error message. A preview can't use sampled data until its sampling run has completed successfully.

## Check related model sampling

You configure related model sampling through the parent model, but you can confirm a related model is being sampled from its own **Sampling** tab:

![Sampling configuration for related model](https://mintcdn.com/hightouch-3c037897/L_vQfA0JQEpeGUUo/images/sampling/related-model.png?fit=max\&auto=format\&n=L_vQfA0JQEpeGUUo\&q=85\&s=85a00cab68dabe08d0040b69e6d89007)

## Use sampled data in a preview

After sampling is enabled and at least one run has completed, a sampling toggle appears next to the preview button in the audience and trait builders. Turn it on when you want a faster, approximate preview.

### Audience previews

With the toggle on, Customer Studio evaluates the audience against the sampled data and marks the result as an approximation.

![Sampled audience](https://mintcdn.com/hightouch-3c037897/L_vQfA0JQEpeGUUo/images/sampling/audience.png?fit=max\&auto=format\&n=L_vQfA0JQEpeGUUo\&q=85\&s=924bf114b8d5fa86a1645a215a1e26ac)

Use a sampled preview to check questions such as:

* Does the filter logic behave the way I expect?
* Am I using the right event, trait, or related model?
* Is the audience roughly the size I expected?

Before a decision that depends on an exact count, preview or run the audience against the full dataset.

### Trait previews

Traits use the same sampling toggle, next to the trait preview button. Sampling is useful for testing a trait definition quickly before evaluating it across the full parent model.

![Sampled trait](https://mintcdn.com/hightouch-3c037897/L_vQfA0JQEpeGUUo/images/sampling/trait.png?fit=max\&auto=format\&n=L_vQfA0JQEpeGUUo\&q=85\&s=cfcc8d15082db07f2fc26977b1776185)

## Sampling doesn't change your final audience

Sampling is a preview optimization. It doesn't limit an audience to the sampled rows. When Hightouch evaluates the audience for a sync or journey, it uses the full schema data, not the sample.

The distinction matters most for marketers: a sampled preview answers "does this logic look right?", not "what is the exact final count?" Confirm any count-dependent decision against the full dataset before you activate.

## Next steps

* [Define your schema](https://docs.hightouch.com/customer-studio/schema.md#speed-up-previews-with-sampling) to enable sampling from a model's **Sampling** tab.
* [Build an audience](https://docs.hightouch.com/customer-studio/usage.md) to preview a segment against the sampled model.
* [Lightning Sync Engine](https://docs.hightouch.com/syncs/lightning-sync-engine.md) to review the prerequisite that powers sampling, snapshots, and journeys.
