Repository navigation
docs(limits): document the statement limits, and warn before a table hits one - #397
Conversation
The Limits page listed the ceilings you plan capacity against — DO storage, req/s, bundle size — but none of the per-statement ones, which are the limits that turn a working app into a runtime error as its schema grows. Those are set by the Workers runtime rather than by SQLite, sit far below SQLite's own defaults, and apply to D1 identically because it runs the same build: 5 terms in a compound SELECT, 100 bound parameters, a 50-byte LIKE pattern, 100 columns per table, a 2 MB row, 100 KB of statement text, expression depth 100. Says which ones the generated SQL absorbs on your behalf and which two are yours to design around, since "we handle it" and "you cannot do this" are very different pieces of advice and the table alone does not distinguish them. Also adds Queues, Workers KV, and Workflows sections — all three are shipped surfaces (`ctx.queues`, `ctx.kv`, `ctx.workflows`) whose limits shape how you use them, and none had an entry. Drops the "Storage tx / 128 KB per op" row: that is the value ceiling for a KV-backed Durable Object, and Lunora's are SQLite-backed, where the equivalent ceiling is the 2 MB row now documented above. Its advice pointed at `insertMany`, which does not help with a per-value cap. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011sk9BLaUZDkPVAZ1sKhuDP
D1 caps a table at 100 columns, and a `.global()` table is provisioned column-per-declared-field. Past the ceiling the store now raises a clear error, but it raises it at provisioning time — on the first request after deploy — and the remediation is a design change: split the table, or collapse the tail of its fields into one object field. That is not advice you want on the commit that breaks the app. `global_table_near_column_limit` fires at 90 columns, leaving ten fields of runway, and surfaces in the Studio's Advisors pages with the rest of the schema lints. Shard-local tables are exempt by construction — their fields live in one JSON document, so no field count can breach a column limit. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011sk9BLaUZDkPVAZ1sKhuDP
✅ Deploy Preview for lunorash ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Warning Review limit reached
Next review available in: 11 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Thank you for following the naming conventions! 🙏 |
|
Thank you for confirming the Contributor License Agreement! 🙏 |
Merging this PR will degrade performance by 10.29%
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ❌ | flat 3 primitives (the notify.send attribute shape) |
55.7 µs | 62.1 µs | -10.29% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing docs/cloudflare-statement-limits (de1e0a1) with alpha (2c0a3e6)2
Footnotes
-
10 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
-
No successful run was found on
alpha(1c45d6d) during the generation of this report, so 2c0a3e6 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## alpha #397 +/- ##
==========================================
+ Coverage 87.09% 87.16% +0.06%
==========================================
Files 1172 1182 +10
Lines 63383 64110 +727
Branches 15447 15786 +339
==========================================
+ Hits 55202 55880 +678
- Misses 7654 7704 +50
+ Partials 527 526 -1
🚀 New features to boost your workflow:
|
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Follow-up to #396. That PR fixed the code against Workerd's SQLite limits; this one makes the limits visible — in the docs you read while designing a schema, and in the Studio while you still have runway.
The docs page had none of them
apps/docs/src/content/docs/limits.mdx— "Cloudflare ceilings you should keep in your head" — listed the ceilings you plan capacity against (DO storage, req/s, bundle size) and not one of the per-statement limits that turn a working app into a runtime error as its schema grows.Those are the interesting ones precisely because they are unintuitive: they are set by the Workers runtime rather than by SQLite, they sit far below SQLite's own defaults, and D1 inherits them because it runs the same build.
SELECTLIKEpatternThe page now says which of these the generated SQL absorbs on your behalf and which two are yours to design around — "we handle it" and "you cannot do this" are very different pieces of advice, and a table alone does not distinguish them.
Also adds Queues, Workers KV, and Workflows sections. All three are shipped surfaces (
ctx.queues,ctx.kv,ctx.workflows) whose limits shape how you use them, and none had an entry.One row was wrong
Dropped
Storage tx | 128 KB / op | Batch large writes via ctx.db.insertMany. That is the value ceiling for a KV-backed Durable Object; Lunora's are SQLite-backed, where the equivalent ceiling is the 2 MB row now documented above. Its advice also pointed atinsertMany, which does nothing for a per-value cap.Warning before the ceiling, not at it
D1 caps a table at 100 columns, and a
.global()table is provisioned column-per-declared-field. #396 made that failure raise a clear error instead of a bare "too many columns" — but it still raises at provisioning time, on the first request after deploy, and the remediation is a design change: split the table, or collapse the tail of its fields into one object field. That is not advice you want on the commit that breaks the app.global_table_near_column_limitfires at 90 columns, leaving ten fields of runway, and surfaces in the Studio's Advisors pages alongside the rest of the schema lints — no new page, route, or RPC, because that surface already exists.Shard-local tables are exempt by construction: their fields live in a single JSON document, so no field count can breach a column limit.
What this deliberately does not cover
A static lint only answers "am I near a limit?" for limits visible in the schema. The runtime ones — how close a document is to 2 MB, actual DO SQLite size — need measured data; the advisor already has that seam (
hot_shardconsumescontext.shardTrafficfrom the Studio backend), so those would be a feeder plus a lint rather than new UI. The per-statement limits are not observable at rest at all: they exist only while a statement is being built, which is why they are handled in the SQL builder.Testing
Three cases on the new lint: the threshold boundary either side (89 columns silent, 90 flagged), and a 200-field shard-local table staying silent. Advisor suite green at 470.
🤖 Generated with Claude Code
https://claude.ai/code/session_011sk9BLaUZDkPVAZ1sKhuDP