Tablesample
Save 90-99% on query costs during development by sampling a percentage of your data.
The Problem
Running a query 20 times during development at $0.63 each = $12.50.
The Solution
Sample 1% of your data to test query logic at a fraction of the cost.
Same query logic, 99% less cost.
How to Enable
Option 1: Config Panel
Set the sample percentage in the Tablesample field in the config panel. The value automatically injects a directive into your query.

Option 2: Comment Directive
Add a comment directive directly in your SQL:
-- querylab:tablesample=1
SELECT * FROM orders WHERE order_date >= '2024-01-01'
-- Cost: $0.006 instead of $0.63
Directive Syntax
-- querylab:tablesample=<percentage>
-- querylab:tablesample-threshold=<size>
tablesample
Sets the sample percentage (0.01-100).
| Percentage | Use Case |
|---|---|
0.1 | Very large tables (billions of rows) |
1 | Standard development |
10 | Validation testing |
100 | Production (same as no directive) |
tablesample-threshold
Only sample tables larger than this size. Smaller tables are queried in full.
-- querylab:tablesample=1
-- querylab:tablesample-threshold=10gb
SELECT * FROM huge_table -- Sampled (>10GB)
JOIN small_lookup -- Not sampled (<10GB)
| Size | Example |
|---|---|
100mb | 100 megabytes |
1gb | 1 gigabyte |
10gb | 10 gigabytes |
1tb | 1 terabyte |
Important Notes
- Results are sampled - counts and aggregations are approximate
- Non-deterministic - different rows each run
- Small tables may return empty results (use higher %)
- Remove directive for production
Workflow
- 1% - Develop and test query logic
- 10% - Validate results look correct
- Remove directive - Run on full data
Insights Panel
When active, the panel shows:
Development Mode: Active
Sample Size: 1%
Dev Cost: $0.006
Prod Cost: $0.63
Savings: 99%