billflare.

D1 Query Budget: reject queries that read too many rows

An open-source TypeScript experiment that measures D1 rows read, checks that results are correct, and rejects a candidate query that exceeds a declared row-read budget, with a CLI that verifies the report.

Products
D1
Source
Community resourceGitHub repository
Author
Bhavya Kumar (Bhavya2025)

Key points

  • In remote D1 runs on 1,000 synthetic orders (October 19, 2026), a query missing a composite index read 1,100 rows versus 20 for the baseline while returning the same 20 orders, and exceeded the budget; changing LIMIT 20 to LIMIT 1 read fewer rows but was rejected as incorrect.
  • The README stresses that these are rows read, not claimed cost savings or production performance, and that the 100-row limit is an explicit testing policy.
  • The checker exits 0 for pass, 1 for a rejected comparison and 2 for an invalid report, and recomputes correctness and the budget decision from result arrays and counters.

Original sources

  1. Last updated

    D1 Query Budget: reject queries that read too many rows

    Open original source

    An open-source TypeScript experiment that measures D1 rows read, checks that results are correct, and rejects a candidate query that exceeds a declared row-read budget, with a CLI that verifies the report.

Author experienceD1 +2

Feng Yi: a free Cloudflare stack still needs an exit map; if a restore into a fresh account takes over 30 minutes, it is cheap but not operationally free

On 2026-11-21, X user @Michael_liyang (Feng Yi) replied to @hiromu_bdy that the free stack still needs an exit map: export D1 to SQL, R2 objects with checksums, and Worker config to version control. Test a restore into a fresh account; if that takes over 30 minutes, the stack is cheap but not operationally free. The 30-minute threshold is the author’s operational test, not an official limit or a billed amount.

D1

Kun Save Point (@Savepoint_kk): a D1 bug rewrote unchanged data into a $2,739.12 bill; $2,141 goodwill credit granted.

Kun Save Point (@Savepoint_kk), an indie developer who says he recently lost his job, says a bug repeatedly rewrote unchanged data while inefficient queries amplified reads, producing a $2,739.12 Cloudflare bill already paid via PayPal (D1 rows written $2,641.00, rows read $64.06, other services $34.06); he says his bills were usually under $10 a month. Cloudflare granted a $2,141 goodwill account credit under case #02391058. He asks for it to be converted into a refund to the original PayPal payment, or at least for relief on the $2,641 write charges, and later writes that the initial request was declined and has been reopened for additional review. On October 25 he adds that he missed the only alert email Cloudflare sent, whose amount was not particularly high, and received no further warning before the large card charge; on October 26 he writes that the refund request to the original payment method is still under further review. On November 10 he posts a timeline saying that after following up on November 10–11, support again stated the $2,141 could only remain as account credit and the remaining $598.12 was still undecided while the ticket was being closed.

Community resourceWorkers +8

Cloudflare Medivh: a self-hosted near-real-time bill estimator

An open-source, self-hosted monitor that adds today’s estimated usage cost to Cloudflare’s daily-updated billable usage, sends summaries, and calls a webhook when the current cycle crosses a budget.