D1/ Query Budgetv0.1

Cloudflare D1 / Query Workbench

The right answer.
At what cost?

Same results can take very different work.
Compare row reads. Check correctness. Catch the regression.

01 / Query Lab

1,000 orders 10 merchants
Choose Your Change
Controlled Fixture

Two identical tables.
One composite index.
A 100-row read budget.

Read-only queries
Selected Experiment

Fetch merchant #1’s latest 20 orders, with and without a composite index.

Ready to Measure

Baseline Indexed

—rows read
Orders returned —Rows written —

Candidate No index

—rows read
Orders returned —Rows written —
Budget: 100 readsShared scale · awaiting data
Ready When You Are

Run the experiment to check the answer and the work behind it.

Decision

Measured results will appear here.

No live query. Original timestamp included.
</> Inspect the EvidenceSQL / query plans / returned orders
Run a comparison or load a recorded report to inspect its evidence.

PrototypeThree fixed scenarios. A CLI that verifies saved reports. Not an automatic benchmark for arbitrary pull requests.

02 / The Method

Correct is necessary.
Efficient deserves a test.

A small experiment with a strict rule:
a cheaper wrong answer never passes.

01

Hold the Data Constant

Two copies of 1,000 synthetic orders. Same merchant, same sorting, same expected results. One table has a lookup index.

02

Measure the Database Work

D1 reports how many rows it reads to find the answer. That can be far more than the number of orders it returns.

03

Check Both Sides of the Tradeoff

Compare every returned field and its order. Then check reads against the 100-row budget. Both checks must pass.