hiromsaeden: an unindexed D1 GROUP BY loop produced $2,129.00 in invoices on a hobby project
On 2026-11-18, Cloudflare Community user @hiromsaeden published a post-mortem of a personal hobby project. An unindexed GROUP BY aggregate query scanned about 877,000 rows to return 30 rows; an unintended loop triggered about 315,000 runs across two billing cycles. In the 15 October–15 November cycle alone, 1,447,580,203,670 rows (1.44 trillion rows) were read. Invoice IN-83890481 was $529.88 USD (paid). Invoice IN-89082487 was $1,599.12 USD ($1,447.58 D1 Rows Read + $6.16 Workers CPU + $145.38 tax). Total billed was $2,129.00 USD; the expected budget was about $20/month. Support cases #02408621 and #02434399 led to a one-time courtesy credit of $953.74 (including a held $275.00), leaving a final balance of $645.38 USD; support said no further adjustments would be made. These amounts are the author’s invoices and credits, not a Billflare case total in this guide.
- Products
- D1Workers
- Source
- Author experienceCloudflare Community
- Author
- hiromsaeden
Key points
- The author says a budget alert fired once at the $37 mark but did not stop further charges, and that D1 currently has no hard spending cap, so an unindexed query loop can keep billing until the Worker or database is deleted or disabled.
- Lessons the author lists: always run EXPLAIN QUERY PLAN before deploying an aggregate query; do not treat billing-alert email as a brake; configure granular per-product usage notifications for D1 Rows Read on the Billable Usage page, because account-level billing alerts fire only once per threshold.
- After noticing the issue on 2–3 November, the author deleted both the Worker and the D1 database; support confirmed reads had stopped. The author says they cannot afford the remaining $645.38 and planned to downgrade the account on 22 November.
Original sources
Published
hiromsaeden: an unindexed D1 GROUP BY loop produced $2,129.00 in invoices on a hobby project
Open original sourceOn 2026-11-18, Cloudflare Community user @hiromsaeden published a post-mortem of a personal hobby project. An unindexed GROUP BY aggregate query scanned about 877,000 rows to return 30 rows; an unintended loop triggered about 315,000 runs across two billing cycles. In the 15 October–15 November cycle alone, 1,447,580,203,670 rows (1.44 trillion rows) were read. Invoice IN-83890481 was $529.88 USD (paid). Invoice IN-89082487 was $1,599.12 USD ($1,447.58 D1 Rows Read + $6.16 Workers CPU + $145.38 tax). Total billed was $2,129.00 USD; the expected budget was about $20/month. Support cases #02408621 and #02434399 led to a one-time courtesy credit of $953.74 (including a held $275.00), leaving a final balance of $645.38 USD; support said no further adjustments would be made. These amounts are the author’s invoices and credits, not a Billflare case total in this guide.
igorarm replied on 2026-11-19: a personal, non-commercial Durable Object alarm left writing to SQLite every ~5 seconds produced an invoice of US$ 2,038 with only ~10k pageviews. Support refunded US$ 1,533.29 as a one-time courtesy and kept US$ 505 (US$ 500 of usage plus the US$ 5 Workers Paid fee). The author says a remaining US$ 500 uncredited seems to come up often in other threads. Spend Management (beta, since 13 November) can set a hard limit with usage_block for Workers and Durable Objects, but as far as the author can tell it does not cover D1 yet, so queries and alert recipients still need to be checked. These US$ figures are igorarm’s reported invoice and credit, already collected as a Billflare case, not a total in this guide.
Open original source
More to read
How far the Cloudflare free tier goes: a walkthrough of its limits from domain to AI
铜匠 (@CopperForgeAI) walks through launching a personal site on Cloudflare and checks each free allowance against the docs, separating the domain plan, the Workers plan and Zero Trust, and warns that free limits stop service while paid overages are charged.
neoblender13: an AI agent’s recursive alarm system turned a ~$10 monthly Cloudflare bill into $1,500; $400 credited.
neoblender13 says the Cloudflare bill is normally around $10 a month, but this month it was hit with a $1,500 bill because an AI agent created a recursive alarm system that ballooned Durable Objects storage writes, and that Cloudflare support was not very helpful. In later replies the author says they did not realize spending limits were alert only, received a $400 credit and still had to pay $1,100, that the single alert email got buried in the inbox, and that a Discord bot now reports costs every 12 hours.
Cloudflare billing pitfalls thread
The author organizes Cloudflare billing risks by product and shares experience with budget alert emails.