Database indexes · Content tag
Browse content discussing database indexes.
36 matching items
Cases · 11
hiromsaeden: an unindexed D1 query loop billed $2,129.00; a $953.74 courtesy credit left $645.38 due.
Cloudflare Community user hiromsaeden, in a post-mortem of a personal hobby project on Workers and D1, says an unindexed GROUP BY aggregate query scanned about 877,000 rows to return 30 rows, and an unintended loop triggered about 315,000 runs across two billing cycles. In the Oct 15 – Nov 15 cycle alone, 1,447,580,203,670 rows (1.44 trillion rows) were read, on top of the previous cycle’s usage. The author says the October invoice IN-83890481 was $529.88 USD, paid in full out of pocket; the November invoice IN-89082487 was $1,599.12 USD ($1,447.58 D1 Rows Read + $6.16 Workers CPU + $145.38 tax); and the total billed was $2,129.00 USD against an expected budget of about $20/month. After noticing the issue on Nov 2–3, the author deleted the Worker and the D1 database; Support confirmed all reads had stopped. In case #02408621, Support offered a $275.00 courtesy credit for October and advised holding it until the November invoice was issued on Nov 15. In case #02434399, Support applied a one-time courtesy credit of $953.74 (which included the held $275.00), leaving a final balance of $645.38 USD, and said the review was complete and no further adjustments can be made. The author, having already paid $529.88, says the remaining $645.38 cannot be afforded and the account will be downgraded on Nov 22. The author also says a budget alert fired once at the $37 mark but did not stop the charges, and that D1 currently has no hard spending cap. There is no Cloudflare staff reply on the public thread; the Support actions are reported by the author.
Reported amount · USD
$2,129
BowTied SaaS Guy: a $4,950 Cloudflare bill with $2,000 credited.
BowTied SaaS Guy (@BowTiedDolphin) says he ran up a $4,950 bill on Cloudflare and was credited $2,000 because no notifications were sent for the amount above $200. In a reply he says he upgraded after hitting free-plan limits and that another Worker’s usage skyrocketed because of a poor index on a public website.
Reported amount · USD
$4,950
D1 row reads: an author reports a $108 bill in seven days.
@shivek_khurana reports a $108 Cloudflare D1 bill over seven days after a workflow read more rows than needed. The author says adding an index reduced reads by about 90%.
Reported amount · USD
$108
A missing D1 index made every lookup scan a 306,000-row table, a four-figure invoice with no budget alert.
Community user stefanr0sca, who relies on an AI coding assistant, says a missing index made every lookup scan a 306,000-row table and produced a four-figure invoice; the exact amount is not given. He says the $10 budget alert created automatically when he upgraded showed $0.00 for the whole cycle and never sent a notification, that the support case was closed automatically after a decision was promised, and that he could not reopen it or open a new one.
Reported amount · USD
Not disclosed
An unindexed D1 query produced a $100.90 rows-read overage.
Community user jaime.ruiz.pallares says an unindexed query in their own code caused a $100.90 D1 Rows Read overage on a $105.90 invoice dated August 13, 2026, already paid. The Billing support form appeared to end at a Back button; after an MVP pointed out that all suggested-article dropdowns must be expanded, the author opened a billing case to request a one-time goodwill credit.
Reported amount · USD
$100.90
A missing index on a D1 DELETE read about 4 trillion rows, a $4,114.97 charge.
Community user user11226 says a missing database index made a DELETE operation repeatedly scan the table, generating about 4.03 trillion D1 rows read in the billing period and an unexpected $4,114.97 bill on what they understood to be a $5-a-month subscription. In follow-ups they accept they should have configured billing alerts, say Cloudflare successfully challenged their chargeback while the urgent billing case took more than three weeks to get a response, and ask for someone to review the circumstances.
Reported amount · USD
$4,114.97
D1: an author reports a $3,500 bill in 48 hours and a full waiver.
@darylginn reports about $3,500 in D1 charges over 48 hours. He says an AI-assisted Postgres migration omitted indexes and caused about 970 billion row reads daily, and that Cloudflare waived the bill.
Reported amount · USD
$3,500
Full-table scans on D1 produced $564.23 in usage for one cycle.
Community user need1026 says a hot-path query that full-scanned a large table without an index drove the May 13 to June 12, 2026 cycle to $564.23 of billable usage, almost all D1 Rows Read ($562.84). The author added the missing indexes on June 5 and asks for a one-time credit before the invoice is finalized.
Reported amount · USD
$564.23
per month
D1 row reads: a $134.14 invoice from unindexed queries.
Justin Ahinon reports that his April 21, 2026 Cloudflare invoice was $134.14, with $127.60 from 127,599,130,859 D1 row reads on a 765,000-row database. He attributes it to full table scans in queries that ran on every page load.
Reported amount · USD
$134.14
contact.freeicon: inefficient D1 queries produced about $748 in four days.
Community user contact.freeicon, running a non-profit free icon library on cloudflare-icon.pages.dev, reports unexpected D1 charges of about $748 from April 13–17, 2026 after a LEFT JOIN GROUP BY query scanned about 6.4 million rows on every page request and bot crawling drove about 200 billion reads. The author replaced the query with a pre-computed indexed column and 72-hour KV caching.
Reported amount · USD
$748
6.3 trillion D1 row reads in one day led to a $6,781 charge and a billing dispute.
Community user markbooth63, a solo developer on Pages and D1, says a coding bug ran a full table scan on every API request on April 7, 2026, causing 6.3 trillion D1 row reads in a few hours and a $6,781 invoice. He says he fixed it and filed a billing dispute the same day, added an index, and that after 10 days without a response the balance was reduced to $6,357 with no explanation.
Reported amount · USD
$6,781
Guides · 25
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.
qianshuixia2026: D1 free row-read cap burned twice in one day, plus R2 and Workers pitfalls after the first paid orders
浅水虾 (@qianshuixia2026) published a 16 November 2026 X article after the first $12 and $29 orders. On 14 November a 10-minute cron full-table scan burned the D1 Free 5 million daily row-read cap in 2 hours 14 minutes; the same evening the author ran wrangler d1 execute --remote statistics that scanned about 4.08 million rows in 5 minutes and hit the cap again, then paid $5 to upgrade to Workers Paid. The article also covers an R2 multipart complete() customMetadata mismatch that failed a >24 MB export five times (50 credits sent as apology), 128 MB / 10 ms / 50-subrequest walls that a paid plan does not lift, and Queues’ 10,000 daily operations with three operations per delivered message.
Anti-abuse code that burned the Durable Objects allowance: heartbeats, rejected requests and D1 scans
Frank Zeng (@frankzeng2020) says an AI-written anti-abuse module pushed Durable Objects to 1.19 million requests against the 1 million included each month, costing him an extra $0.15; a budget alert email caught it, and the audit also found a D1 query path scanning 925 million rows a day and a signing key re-imported on every request. He shares a read-only self-audit prompt.
D1 on the free plan: unindexed queries burn rows read
风易 (@Michael_liyang) says the costliest thing on the free plan is not writes but queries without an index: D1 bills by rows read and an unindexed query scans the whole table, multiplying rows read (a figure he marks as still to be confirmed). He recommends indexing hot query fields, selecting only needed columns and logging slow queries.
Bradley Leatherwood: on Durable Objects every SQLite row read is billed; a quiet-moment ANALYZE produced 20,006 reads to return 5 rows, and a plain ANALYZE on a 37,000-row object was billed about 2 million rows
On 2026-11-02, Bradley Leatherwood published an inKibra note, also linked from the X account @mayliveforever, about SQLite inside Cloudflare Durable Objects. The platform bills every row SQLite reads, not just the rows it returns: a lookup that returns 5 rows but checks 20,000 is billed for 20,000. The author says that for several days the Cloudflare bill ran around $66 a day, almost all of it rows read, because queries were reading every row when no index was used; the peak day came to $366, mostly rows written. These amounts are the author’s reported invoices, not a Billflare case total in this guide. The same event is already recorded as a Billflare case; this entry is the technical post-mortem, including later figures the case snapshot may not yet carry.
D1 rows read and Queues operations: two free allowances that run out with few users
Su (@Sukiea1008) explains why D1’s rows-read allowance and Queues’ operation count are easy to misjudge: a query returning 10 rows may scan 10,000, and one queue message usually costs three operations plus retries. She adds notes on indexes, KV’s one-write-per-second per key and Hyperdrive’s query count.
Lunora: codegen lints that name the billing meter a loop moves
Daniel (@_prisis_) says a Cloudflare bill spike is usually a loop, not traffic; his framework Lunora now flags count_without_index, queue_dispatch_cycle, cron_every_minute and container_long_sleep_after at codegen, before deploy, naming the meter each one moves.
WquGuru: a read-only Cloudflare billing audit prompt
WquGuru (@wquguru) shares a read-only audit prompt that checks account usage, D1 query plans, loops and retries, Durable Object wake-ups, high-priced operations and Worker config, then ranks risks by worst-month cost.
A $500 D1 bill? Check rows written first
Layerbase walks through the D1 write meter using a public $513.20 invoice: writes cost 1,000× reads per row, indexes add written rows, and common causes include reprocessing jobs, upsert loops and writes on the read path.
A polling table scan can read billions of D1 rows with no users
Jad (@JadMadi), replying to a $500 D1 bill thread, says D1 bills per row read rather than per query, so an unindexed scan on a polling interval can read billions of rows; he advises checking indexes and query plans.
Keeping a vibe-coded site alive: whether quotas stop or bill, and D1 row costs
Ren (@Ryrenz) sorts the ways a vibe-coded site “dies” into downtime, a blown bill and silent breakage; the billing sections cover what each platform does when a quota runs out and why D1 bills by rows scanned and written.
Writing a Cloudflare cost-guard skill for coding agents
An AIIDE List guide on turning Cloudflare billing safety into an agent skill with BUILD, AUDIT, PREDEPLOY and INCIDENT modes, plus risk rules for D1 queries, Durable Object alarms, polling, Queues and R2.
How I keep Cloudflare under $5: where surprise bills come from
Ashish Sharma (@sarmaasis) runs several sites on the $5 Workers Paid plan and lists, product by product, the usage patterns he says quietly run up a Cloudflare bill, ending with a 12-item checklist.
After a $10,000 loop bill: budget alerts and a cost-audit prompt for vibe-coded projects
铁柱AGI (@cgnot996) writes an X article that walks through creating a Cloudflare budget alert, explains why it is only a notice, lists cost-amplifying code patterns, and gives a read-only audit prompt and steps for when a bill has already spiked.
Watch D1’s daily row quotas while testing
Michal Raczka (@michalraczka) warns that D1’s daily row read and write quotas can stop all D1 queries until midnight UTC, notes that indexes trade reads for extra writes, and moves heavy tests to local Miniflare.
D1 free tier hard limits: budgeting a small app’s database after the September 2026 enforcement
涂阿燃 reads Cloudflare’s September 2026 D1 free tier enforcement notice and turns it into a budget for small apps: how rows are metered, which query patterns burn the daily quota, how to find them, and how to degrade gracefully when the quota runs out.
D1 enforces free tier daily query limits
Cloudflare’s changelog announces that from September 1, 2026, D1 queries on Workers Free accounts fail once the account exceeds its daily row read or row write limit.
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.
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.
FlareCost: D1 Free daily row-write limit error at 100,000 rows
FlareCost's error page explains the D1 message shown when an account hits 100,000 rows written in a UTC day on Free: writes fail until 00:00 UTC, Workers Paid includes 50 million rows written a month then $1 per million, and indexes make the cap easier to hit because writing an indexed column also writes the index. Reviewed against official pages on 2026-11-02.
FlareCost: what a D1 full table scan costs past 25 billion rows read
FlareCost's scenario scans the same 5-million-row table 200 times a day for 30 days: 30 billion rows read, 5 billion of them billed at $0.001 per million, totalling $10.00 on Paid including the $5 minimum. It stresses that D1 bills rows scanned, not rows returned, and that indexes cut reads but add a written row when the indexed column changes. Rates as published on 2026-11-02.
FlareCost: D1 rows-written allowance and the cost of indexes
FlareCost’s d1-rows-written-allowance guide says Free allows 100,000 rows written per day (reset 00:00 UTC) and Paid includes 50 million per month then $1 per million; INSERT, UPDATE and DELETE all count, and each index adds another written row. Reviewed 2026-11-02.
Cutting a D1 bill 95% with composite indexes, ANALYZE and a KV cache
Justin Ahinon walks through finding the four queries behind 127.6 billion D1 rows read and fixing them with indexes, ANALYZE and cache-aside KV for layout-level data.
Where to see D1 rows read and Durable Objects requests before the invoice
Howard tabulates eight public 2026 Cloudflare bill spikes (seven D1 rows read, one Durable Object alarm loop) and turns them into concrete places to check and a ten-times-baseline alert rule.
Estimating a SaaS bill on Cloudflare Workers by billing unit, not by MAU
李辰 of 小李出海笔记 argues that a Cloudflare SaaS bill cannot be read off monthly active users and walks through Workers, D1, R2, Workers AI and Vectorize by their own billing units, with an estimation template and a checklist.