Why this exists
Per-tenant analytics on Cloudflare should be quick and easy — not a second platform, not a always-on warehouse, not full-table scans through D1.
rubberduck is a hypertenant analytic database built from stuff you already have: R2 for Parquet, Workers for DuckDB SQL, D1 for org metadata. Drop files, run SQL, scale to zero. That's it.
Faster than D1 — by a lot
D1 is SQLite. Perfect for orgs, keys, and duckling metadata. Terrible for repeated full scans on analytical data.
Same 1M ClickBench-shaped rows, in-process (SQLite ≈ D1 engine vs DuckDB):
| query | D1-class (sqlite) | DuckDB | speedup |
|---|---|---|---|
GROUP BY OSName | 244ms | 10ms | 25× |
| region avg | 235ms | 2.4ms | 98× |
count(*) looks similar. Aggs do not. That’s why the lake lives in R2 and SQL runs in DuckDB on Workers — not in D1 tables.
D1 also meters rows read. A full 1M-row groupby costs ~1M rows per query. Workers meter CPU-ms instead. For bursty embedded analytics, that economics swap is the point.
Scale to zero
Most tenants are idle most of the time. Billing them like an always-on warehouse loses money.
rubberduck ducklings are disposable compute over durable Parquet. Query → Worker wakes → DuckDB scans R2 → done. Idle floor is roughly the Workers Paid minimum (~$5/mo) plus cheap R2 storage — not warm CU 24/7.
Cloudflare-native stack
| Plane | Service | Job |
|---|---|---|
| Control | D1 | orgs, ducklings, metrics |
| Data | R2 | Parquet lake org_*/… |
| Compute | Workers | DuckDB-WASM SQL |
Everything deploys with wrangler. Same account, same bindings, same object storage you’re already paying for.
When you need more than a Worker
Worker ducklings have a ~64 MB envelope. That’s plenty for embedded analytics at SF0.1 / ~1M-row scale. When queries outgrow it, you graduate compute — not the dataset. See Scaling.
Sweet spot
- Embedded per-tenant analytics in a SaaS on Cloudflare
- Bursty orgs, mostly idle
- Parquet lakes up to Worker working-set size
- Teams who want MotherDuck-shaped tenancy without a second vendor
Pick your lane
| If you need… | Use |
|---|---|
| CF-native, scale-to-zero, DIY lake | rubberduck |
| Managed ducklings, IAM, SLA | MotherDuck |
| Firehose ingest, multi-TB warm scans | ClickHouse |