[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"tools-page-cloudflare-d1-pricing-calculator":3},{"page":4,"related":176,"variants":194},{"path":5,"name":6,"title":7,"description":8,"checkedAt":9,"sources":10,"faq":29,"related":48,"nuxter":52,"body":55,"tool":174,"preset":175},"\u002Ftools\u002Fcloudflare-d1-pricing-calculator","Cloudflare D1 pricing calculator","Cloudflare D1 Pricing Calculator and Batch Limits","Cloudflare D1 pricing calculator. Turn users and queries into rows read and written, check the Free plan's daily limits, and size batch inserts under D1's caps.","2026-10-06",[11,14,17,20,23,26],{"label":12,"url":13},"Cloudflare D1 docs, Pricing","https:\u002F\u002Fdevelopers.cloudflare.com\u002Fd1\u002Fplatform\u002Fpricing\u002F",{"label":15,"url":16},"Cloudflare D1 docs, Limits","https:\u002F\u002Fdevelopers.cloudflare.com\u002Fd1\u002Fplatform\u002Flimits\u002F",{"label":18,"url":19},"Cloudflare D1 docs, D1 Database","https:\u002F\u002Fdevelopers.cloudflare.com\u002Fd1\u002Fworker-api\u002Fd1-database\u002F",{"label":21,"url":22},"Cloudflare D1 docs, Query JSON","https:\u002F\u002Fdevelopers.cloudflare.com\u002Fd1\u002Fsql-api\u002Fquery-json\u002F",{"label":24,"url":25},"Cloudflare Workers docs, Pricing","https:\u002F\u002Fdevelopers.cloudflare.com\u002Fworkers\u002Fplatform\u002Fpricing\u002F",{"label":27,"url":28},"Drizzle ORM issue 2479, D1 too many SQL variables at offset","https:\u002F\u002Fgithub.com\u002Fdrizzle-team\u002Fdrizzle-orm\u002Fissues\u002F2479",[30,33,36,39,42,45],{"question":31,"answer":32},"How much does Cloudflare D1 cost?","D1 bills rows read, rows written and storage, and nothing for compute time or egress. The Workers Paid plan includes a monthly allowance of each and charges per million rows and per GB-month past it. The calculator shows how close your load is to each allowance.",{"question":34,"answer":35},"Is Cloudflare D1 free?","Yes. D1 is on the Workers Free plan, with daily limits on rows read and written and caps on storage, database size and the number of databases. Cloudflare says the Free plan will always include D1 for prototyping.",{"question":37,"answer":38},"What happens when I hit D1's Free plan limits?","Past the daily read or write limit, every D1 query on the account returns an error until the limits reset at 00:00 UTC. Past the storage limit, you have to delete data before you can insert, create tables or add indexes again. Upgrading to Workers Paid lifts the limits, usually within minutes.",{"question":40,"answer":41},"Why do I get 'too many SQL variables' on D1?","D1 caps the values one query can bind, and a multi-row INSERT binds one value per column per row, so a large insert passes the cap quickly. The error reads too many SQL variables at offset. Split the insert into chunks under the cap, or pass a list as one JSON value and expand it with json_each.",{"question":43,"answer":44},"How many rows can I insert in one D1 query?","Divide D1's cap on bound parameters by the values each row binds, and round down. Count every column the INSERT sets, including ones your ORM fills in. The batch calculator above does the division and writes a Drizzle snippet that chunks the rows.",{"question":46,"answer":47},"Do indexes make D1 cheaper or more expensive?","Usually cheaper. An index lets a filtered query read a few rows instead of the whole table. Each write that sets an indexed column writes one extra row for the index, and Cloudflare says the saved reads offset that in nearly all cases.",[49,50,51],"cloudflare-workers-pricing-calculator","uuid-v7-generator","cloudflare-cron-generator",{"body":53,"to":54},"Nuxter keeps its app's tables in Postgres through Hyperdrive and gives D1 only Nuxt Content's pages, so a Nuxter app's D1 reads come from the docs and pages it serves.","\u002Ffeatures",{"type":56,"value":57,"toc":165},"minimark",[58,63,88,107,111,114,118,132,145,149,152,156],[59,60,62],"h2",{"id":61},"how-d1-counts-rows","How D1 counts rows",[64,65,66,67,71,72,75,76,79,80,83,84,87],"p",{},"Rows read are rows scanned, not rows returned. ",[68,69,70],"code",{},"SELECT * FROM users"," reads every row, and so does a ",[68,73,74],{},"WHERE"," on a column without an index, even when it returns one row. Rows written count each row an ",[68,77,78],{},"INSERT",", ",[68,81,82],{},"UPDATE"," or ",[68,85,86],{},"DELETE"," changes, and schema changes can count as both. Row size does not matter: a wide row and a narrow one count the same.",[64,89,90,91,94,95,98,99,102,103,106],{},"Every query's result carries a ",[68,92,93],{},"meta"," object with ",[68,96,97],{},"rows_read"," and ",[68,100,101],{},"rows_written",". Run your real queries through ",[68,104,105],{},"wrangler d1 execute"," and read those numbers instead of guessing. Queries from the dashboard and Wrangler are billed like any other.",[59,108,110],{"id":109},"indexes-cut-reads-and-add-a-write","Indexes cut reads and add a write",[64,112,113],{},"An index on a column you filter or join on lets D1 find the matching rows without reading the rest of the table. A write that sets an indexed column also writes to the index, and that counts as a second row. Set the indexes each write touches to the number of indexes on the columns your writes set. Cloudflare says the saved reads offset the extra write in nearly all cases.",[59,115,117],{"id":116},"too-many-sql-variables","Too many SQL variables",[64,119,120,121,124,125,127,128,131],{},"D1 limits how many values a single query can bind, and the limit holds for each statement inside ",[68,122,123],{},"db.batch()"," too. A multi-row ",[68,126,78],{}," binds rows times columns values, so it reaches the limit sooner than it looks. The error reads ",[68,129,130],{},"too many SQL variables at offset",", and Drizzle has an open issue asking it to chunk inserts on its own.",[64,133,134,135,137,138,140,141,144],{},"There are two fixes. Chunk the rows so each ",[68,136,78],{}," stays under the limit, and send the chunks in one ",[68,139,123],{},", which runs them in order as one transaction and rolls back if any fails. For lookups and updates over a list of ids, bind the list as one JSON string and expand it in SQL with ",[68,142,143],{},"json_each",", so the whole list takes a single parameter.",[59,146,148],{"id":147},"at-the-free-plans-limits","At the Free plan's limits",[64,150,151],{},"Past the daily read or write limit, every D1 query on the account fails until the reset at 00:00 UTC. Storage works differently: once it is full, you have to delete data before you can insert again, create tables or add indexes. Moving to Workers Paid lifts the limits, typically within minutes.",[59,153,155],{"id":154},"d1-or-postgres-through-hyperdrive","D1 or Postgres through Hyperdrive",[64,157,158,159,164],{},"D1 is built on SQLite. Each database runs one query at a time and has a size cap that Cloudflare cannot raise, because D1 is designed for many smaller databases, such as one per tenant. An app that keeps every tenant in one large schema may suit Postgres through Hyperdrive better. The ",[160,161,163],"a",{"href":162},"\u002Ftools\u002Fcloudflare-workers-pricing-calculator","Workers pricing calculator"," prices either choice beside the rest of a Worker's bill.",{"title":166,"searchDepth":167,"depth":167,"links":168},"",2,[169,170,171,172,173],{"id":61,"depth":167,"text":62},{"id":109,"depth":167,"text":110},{"id":116,"depth":167,"text":117},{"id":147,"depth":167,"text":148},{"id":154,"depth":167,"text":155},"cloudflare-d1-pricing-calculator",null,[177,182,188],{"path":162,"tool":49,"name":178,"title":179,"description":180,"summary":181,"checkedAt":9},"Cloudflare Workers pricing calculator","Cloudflare Workers Pricing Calculator for a SaaS","Cloudflare Workers pricing calculator for a SaaS. Turn monthly users into a bill for Workers, D1, KV, R2, Queues and AI, and find the first Free limit you hit.","Turn monthly users into a Workers, D1, KV, R2, Queues and AI bill, and find the first Free plan limit you hit.",{"path":183,"tool":50,"name":184,"title":185,"description":186,"summary":187,"checkedAt":9},"\u002Ftools\u002Fuuid-v7-generator","UUID v7 generator","UUID v7 Generator and Decoder, with ULID and NanoID","A UUID v7 generator and decoder for RFC 9562 IDs, with ULID, NanoID and UUIDv4 to compare, a monotonic bulk mode, and Postgres 18, Drizzle and D1 code.","Time-ordered IDs with ULID, NanoID and UUIDv4 to compare, a decoder, and Postgres, Drizzle and D1 code.",{"path":189,"tool":51,"name":190,"title":191,"description":192,"summary":193,"checkedAt":9},"\u002Ftools\u002Fcloudflare-cron-generator","Cloudflare cron trigger generator","Cloudflare Cron Triggers Generator and Tester","Build and test Cloudflare Cron Triggers: plain-English meaning, the next runs in UTC and your time zone, and the Wrangler and Nitro scheduledTasks config.","Build a cron trigger, read it in plain English, see its next runs and copy the Wrangler and Nitro config.",[]]