A small project read 33 billion D1 rows: where the reads came from and a pre-release checklist
Sylwair reviews how a small content site on Workers Paid used more D1 rows read than the monthly allowance, explains how D1 counts scanned rows, names the four query patterns that multiplied reads, and lists the fixes and a checklist to run before shipping.
- Products
- D1Workers
- Source
- Author experienceSylwair blog
- Author
- Sylwair
Key points
- The author writes that his billing page showed about 33 billion D1 rows read against the 25 billion included, adding a D1 Rows Read line of $8.22, and that the cause was not user growth but queries repeatedly scanning large ranges of data.
- He explains that D1 counts rows scanned, not rows returned, and gives a rough formula: total reads = requests × rows scanned per query × queries per request; crawler traffic on the sitemap, scheduled URL-submission queues and background statistics keep running even when no person visits. Cloudflare’s current D1 pricing page also says rows read counts rows scanned rather than rows returned.
- The four amplifiers he found: a search or results page that recomputed historical statistics on every visit; the same request querying the same data more than once; a dynamic sitemap recomputed from the database on each fetch; and an SEO submission queue that ran too often with large batches.
- His fixes: precompute summary tables, reuse data already queried in a request, serve the sitemap from a periodically refreshed snapshot, lower cron frequency and batch size, and index columns used for filtering, sorting and status; he found the D1 Metrics view and the Query Insights ranking by rows read the most useful way to find the problem, and says he will not claim an exact saving from screenshots.
- Before release he now asks: will this endpoint be crawled or triggered by a schedule, how many rows does each query scan versus return, are the right indexes in place, are there duplicate queries, can the sitemap be a snapshot, can statistics be pre-aggregated, how often does the queue run, and is the billable usage trend normal — and every cron job should state its frequency, maximum items per run, estimated rows scanned and how to pause it.
Original sources
Published
一个小项目把 D1 读到 330 亿行:Cloudflare Workers 付费后也要盯账单
Open original sourceSylwair reviews how a small content site on Workers Paid used more D1 rows read than the monthly allowance, explains how D1 counts scanned rows, names the four query patterns that multiplied reads, and lists the fixes and a checklist to run before shipping.
Read originalArchived
This archive does not contain the complete text.
一个小项目把 D1 读到 330 亿行:Cloudflare Workers 付费后也要盯账单
这次被 D1 教育了一次。
More to read
FlareCost: Free plan limits that fail the request (not bill)
FlareCost’s free-plan-limits page lists Workers, KV, D1, R2, Durable Objects and Queues Free meters in one table: daily Free limits reset at 00:00 UTC and fail the request instead of billing, except R2 which bills past its monthly free tier on any plan. Reviewed against official pricing pages on 2026-11-02.
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. On 26 November 2026 the author posted another public thread asking what a "final decision" means. He says that in the first case an agent called a refund impossible as a "final decision," then submitted it for further review; that after several business days he was told the account credits could not be refunded while the remaining amount was still under review; and that the first case was later closed without a clear resolution of that remaining amount. He opened a second case; an agent said the remaining amount had been definitively rejected, another "final decision." After the author posted on X, a senior billing specialist (Agent D) confirmed that the previously rejected amount had actually been refunded. The author asked whether the larger $2,141 account credit could be converted into a cash refund; after being told it was under review, an agent from the first case declared another "final decision": no refund. The author asks who reviews these requests and why a supposedly final rejection was later followed by an actual refund, and says D1 on Workers Paid still lacks a configurable hard spending cap. The posts cite cases #02391058 and #02447083. There is no staff reply on that public thread.
Six free allowances and four kinds of cost: estimating a Cloudflare bill line by line
Su (@Sukiea1008) lists six common Cloudflare free allowances and four kinds of cost — separately bought items, hard stops at free limits, metered usage on enabled services, and other services such as models and email — and walks through a PDF summariser to show why each line must be estimated in its own unit.