D1 scheduled updates: count runs, not empty queues
wickedev explains how a once-daily full-table update ran hundreds of times a day, and shares the checks he would add after an unexpected D1 bill.
- Products
- D1Workers
- Source
- Author experiencewickedev on X
- Author
- wickedev (@wickedev88)
Key points
- The author describes a cron that ran every two minutes. Its ranking-update step used an UPDATE without a WHERE clause on a 580,000-row table, triggered when the work queue was empty. Once collection finished, the empty queue let the once-daily step run repeatedly.
- He recommends recording whether the job has already run today, separately counting full-table operations, and imposing an application-side run limit instead of using the empty queue as the once-daily gate.
- The author says he received budget emails but they did not stop usage. His suggestions include graduated alert thresholds. Cloudflare’s budget-alert documentation likewise states that alerts do not pause or cap usage.
Original sources
Published
Original post
Read on 𝕏wickedev explains how a once-daily full-table update ran hundreds of times a day, and shares the checks he would add after an unexpected D1 bill.
wickedev
@wickedev88 · Original 𝕏 post
Cloudflare D1 청구서 건 중간 업데이트입니다. 결론부터: 9월 청구서 $6,209 중 $5,704를 1회 예외로 PayPal 환불해주기로 승인받았고, 10월분 $4,637은 10/24 청구서가 나오면 같은 사고의 연장선으로 검토해주기로 했습니다. 처음엔 계정 크레딧으로 처리됐는데, 이 글을 보고 @ashleypeacock 이… https://t.co/cLNPTgEiEw
More to read
Budget alerts
Cloudflare documents account-wide spend alerts and their notification limits.
mcwangcn reports $1,300 in D1 charges after a bot attack.
@mcwangcn says D1 writes previously cost over a thousand dollars and separately mentions Workers CPU charges without giving an amount. He later shares a Cloudflare bill and says $1,300 of its $3,600 came from D1 after a bot attack.
Moving a blog to EmDash on the D1 free tier: row reads ran out and the author rolled back twice
tozai (@ccietry_tozai) tried moving a WordPress blog with about 800 daily unique visitors and 7,000 page views to EmDash on Cloudflare, exceeded D1’s 5 million daily rows-read free limit, and went back to WordPress rather than move to a paid plan without a hard cap.