Skip to main content

Development Mode

Save 90-99% on query costs during development using TABLESAMPLE.


The Problem

Running a query 20 times during development at $0.63 each = $12.50.

The Solution

Add a comment directive to sample 1% of data:

-- querylab:tablesample=1

SELECT * FROM orders WHERE order_date >= '2024-01-01'
-- Cost: $0.006 instead of $0.63

Same query logic, 99% less cost.


Syntax

-- querylab:tablesample=<percentage>
PercentageUse Case
0.1Very large tables (billions of rows)
1Standard development
10Validation testing
100Production (same as no directive)

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. 1% - Develop and test query logic
  2. 10% - Validate results look correct
  3. 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%