Skip to content

Increase the SQLite row limit to 4 MiB - #7020

Open
joshthoward wants to merge 1 commit into
mainfrom
jhoward/increase-sqlite-row-limit
Open

Increase the SQLite row limit to 4 MiB#7020
joshthoward wants to merge 1 commit into
mainfrom
jhoward/increase-sqlite-row-limit

Conversation

@joshthoward

Copy link
Copy Markdown
Contributor

No description provided.

@ask-bonk

ask-bonk Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

APIError: Invalid Anthropic API Key

github run

2 similar comments
@ask-bonk

ask-bonk Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

APIError: Invalid Anthropic API Key

github run

@ask-bonk

ask-bonk Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

APIError: Invalid Anthropic API Key

github run

@ask-bonk

ask-bonk Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

@joshthoward Bonk workflow failed. Check the logs for details.

View workflow run · To retry, trigger Bonk again.

Comment on lines -1375 to +1374
// This limit is set higher than what is suggested on sqlite.org/security.html
// because we want to allow storing values of 1MiB, and we added some extra
// padding on top of that
sqlite3_limit(db, SQLITE_LIMIT_LENGTH, 2200000);
// We use most of the suggested limits from sqlite.org/security.html. Note that sqlite3_limit()
// does NOT return an error code; it returns the old limit.
sqlite3_limit(db, SQLITE_LIMIT_LENGTH, 4 * 1024 * 1024);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously we allowed 10% over our documented limit for padding. I have no idea what padding we're accounting for. In the KV interface, we cared about V8 serialization overheads, but we don't use V8 serialization with SQLite. SQLite itself might have padding that I don't know about it.

I guess we will need to update our documentation to say that it's 4 MB, inclusive of any padding the system may add under the covers? That seems less satisfying.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea why we did that TBH. I just did the standard thing of implementing a limit using IEC units and documenting the lower SI unit, since folks don't pay attention to the difference.

@a-robinson a-robinson Aug 18, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We originally did it because v8 serialization added some extra bytes to a value, so when we advertised a limit of 128 KiB we had to add some cushioning or else trying to store an ArrayBuffer or string of exactly 128 KiB (or very close to 128 KiB) would fail, which is quite frustrating as a user.

I'd imagine the same argument still applies here for the KV interface on sqlite DOs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants