FlareCost: D1 OFFSET still burns rows-read on Free; prefer keyset pagination
@FlareCost replies that D1 Free meters rows read (scanned), not rows returned, so OFFSET still burns the 5M/day Free cap (reset 00:00 UTC), and that keyset pagination on an index avoids that. The parent post notes D1 now fails any query result over 50 MB.
- Products
- D1
- Source
- Author experienceX
- Author
- FlareCost
Key points
- @serhiichernenko writes that D1 now fails any query result over 50 MB and that the post suggests LIMIT/OFFSET, but OFFSET still reads every skipped row against the Free 5M rows/day cap; the author paginates chat history by keyset on an index instead.
- @FlareCost agrees and points to its free-plan-limits page for the caps.
Original sources
Published
Original post
Read on 𝕏@FlareCost replies that D1 Free meters rows read (scanned), not rows returned, so OFFSET still burns the 5M/day Free cap (reset 00:00 UTC), and that keyset pagination on an index avoids that. The parent post notes D1 now fails any query result over 50 MB.
FlareCost
@FlareCost · Original 𝕏 post
@serhiichernenko @CloudflareDev Right call — D1 Free meters rows read (scanned), not rows returned, so OFFSET still burns the 5M/day Free cap (reset 00:00 UTC). Keyset on an index avoids that. Caps: https://t.co/VCZEQZfRZ6
@serhiichernenko: Parent reply: D1 fails results over 50 MB; OFFSET still counts skipped rows toward Free rows-read; the author uses keyset pagination on activityAt plus id.
Read on 𝕏Serhii Chernenko
@serhiichernenko · Original 𝕏 post
@CloudflareDev D1 now fails any query result over 50 MB, and the post suggests LIMIT/OFFSET. But D1 counts rows read, and OFFSET still reads every row it skips. On Workers Free that limit is 5M rows a day. My chat history list pages by key instead: activityAt plus id, on an index
More to read
Cloudflare Billing Helper: a browser extension that shows free-allowance progress on the billing page
Meathill (@meathill1) built a Chrome extension that adds a panel to Cloudflare’s Billable Usage page: remaining free allowance for each billing line, projected exhaustion dates, estimated cost for the period, and a breakdown by Worker, KV namespace, D1 database, R2 bucket and Durable Object.
ivebenfreed: a Dynamic Workers bill came to nearly $80 in October after unique-worker charges.
X user @ivebenfreed (Ben Freed) says the Dynamic Workers bill came to nearly $80 last month because each Code Mode call spun up a new instance, including via Cloudflare's official @cloudflare/codemode package, at $0.002 per unique worker per day past the first 1,000 a month; on the worst day in October there were over 12,000 of them. The author later stopped using Dynamic Workers (the count went from roughly 2,600 a day in October to zero since November 13). “October's pace would have come to about $155 a month” is a projection and is not used as the event amount. Replies in the thread are not official Cloudflare responses.
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.