---
title: "TABLESAMPLE"
description: "TABLESAMPLE (or a SAMPLE clause) returns a random subset of a table's rows, letting queries run faster on a representative fraction of the data instead of the full table."
canonical: "https://motherduck.com/glossary/tablesample/"
related:
  - title: "SAMPLE | MotherDuck Docs"
    url: "https://motherduck.com/docs/sql-reference/duckdb-sql-reference/sample/"
  - title: "Why Use DuckDB for Analytics?"
    url: "https://motherduck.com/blog/six-reasons-duckdb-slaps/"
  - title: "TEMPORARY TABLES | MotherDuck Docs"
    url: "https://motherduck.com/docs/sql-reference/motherduck-sql-reference/temporary-tables/"
gated_asset:
  title: "DuckLake on MotherDuck"
  url: "https://motherduck.com/product/ducklake/"
---

# TABLESAMPLE

> TABLESAMPLE (or a SAMPLE clause) returns a random subset of a table's rows, letting queries run faster on a representative fraction of the data instead of the full table.

## Overview
Sampling clauses let a query operate on a random subset of rows rather than the entire table — useful for quick exploratory analysis, testing a query's logic cheaply before running it at full scale, or approximate analytics where perfect precision isn't required. Standard SQL expresses this as `TABLESAMPLE (method (percentage))` after a table reference.

```sql
SELECT * FROM large_events_table TABLESAMPLE BERNOULLI (1);  -- ~1% of rows
```

Common sampling methods include **Bernoulli** (each row independently included with the given probability — precise but scans the full table) and **system**/**block** (samples whole storage blocks/pages — faster but less statistically uniform).

<glossary-callout guide="duckdb-cheatsheet-full" />

## DuckDB specifics
DuckDB implements sampling with its own `USING SAMPLE` clause, applied right after the `FROM` clause (after joins, before `WHERE` and aggregation):

```sql
SELECT * FROM addresses USING SAMPLE 1%;                 -- default (system) method
SELECT * FROM addresses USING SAMPLE 1% (bernoulli);     -- explicit Bernoulli sampling
SELECT * FROM addresses USING SAMPLE 10 ROWS;            -- fixed row count instead of a percentage
```

DuckDB supports sampling by percentage or by a fixed row count, with selectable methods (`bernoulli`, `system`, `reservoir`), and a `REPEATABLE (seed)` option for deterministic, reproducible samples across runs. DuckDB's `USING SAMPLE` syntax is the recommended way to sample in DuckDB; the standard `TABLESAMPLE` keyword form is also recognized for portability with code written against other engines.