Skip to content

docs: add spec for query caching#3217

Draft
gdorsi wants to merge 2 commits into
mainfrom
feat/resolve-query-cache
Draft

docs: add spec for query caching#3217
gdorsi wants to merge 2 commits into
mainfrom
feat/resolve-query-cache

Conversation

@gdorsi
Copy link
Copy Markdown
Collaborator

@gdorsi gdorsi commented Nov 26, 2025

No description provided.

@vercel
Copy link
Copy Markdown

vercel Bot commented Nov 26, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
design-system Ready Ready Preview, Comment Dec 14, 2025 6:54pm
gcmp-homepage Ready Ready Preview, Comment Dec 14, 2025 6:54pm
jazz-nextjs Ready Ready Preview, Comment Dec 14, 2025 6:54pm
jazz-richtext-prosekit Ready Ready Preview, Comment Dec 14, 2025 6:54pm
jazz-richtext-tiptap Ready Ready Preview, Comment Dec 14, 2025 6:54pm
passkey-demo Ready Ready Preview, Comment Dec 14, 2025 6:54pm
quint-ui Ready Ready Preview, Comment Dec 14, 2025 6:54pm
reactions-demo Ready Ready Preview, Comment Dec 14, 2025 6:54pm
20 Skipped Deployments
Project Deployment Review Updated (UTC)
clerk-demo Ignored Ignored Preview Dec 14, 2025 6:54pm
file-upload-demo Ignored Ignored Preview Dec 14, 2025 6:54pm
form-demo Ignored Ignored Preview Dec 14, 2025 6:54pm
image-upload-demo Ignored Ignored Preview Dec 14, 2025 6:54pm
jazz-chat Ignored Ignored Preview Dec 14, 2025 6:54pm
jazz-chat-1 Ignored Ignored Preview Dec 14, 2025 6:54pm
jazz-chat-2 Ignored Ignored Preview Dec 14, 2025 6:54pm
jazz-filestream Ignored Ignored Preview Dec 14, 2025 6:54pm
jazz-homepage Ignored Ignored Preview Dec 14, 2025 6:54pm
jazz-image-upload Ignored Ignored Preview Dec 14, 2025 6:54pm
jazz-inspector Ignored Ignored Preview Dec 14, 2025 6:54pm
jazz-multi-cursors Ignored Ignored Preview Dec 14, 2025 6:54pm
jazz-organization Ignored Ignored Preview Dec 14, 2025 6:54pm
jazz-paper-scissors Ignored Ignored Preview Dec 14, 2025 6:54pm
jazz-richtext Ignored Ignored Preview Dec 14, 2025 6:54pm
jazz-todo Ignored Ignored Preview Dec 14, 2025 6:54pm
jazz-vector-search Ignored Ignored Preview Dec 14, 2025 6:54pm
jazz-version-history Ignored Ignored Preview Dec 14, 2025 6:54pm
music-demo Ignored Ignored Preview Dec 14, 2025 6:54pm
passphrase-auth-demo Ignored Ignored Preview Dec 14, 2025 6:54pm

this.unstable_branch,
undefined, // calleer stack
this.cacheable, // propagate cacheable flag to child
this.cacheKey // propagate cache key to child
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.

How's the parent scope's cache key used by the child scope?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

If provided, the child uses that one as cacheKey.

}

export interface DBTransactionInterfaceAsync {
updateCoValue(
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.

I understand this spec is not focused on how this will be implemented, but it'd be nice to have a bit more detail about how we plan to update the cache. I guess there's a tradeoff here between cache granularity, how many DB read/writes we perform on each load/update operation and amount of storage used by the caching layer, and I'm not sure where we're aiming at

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, you are right, I wanted to give this some more thinking before writing down some guidance and then my focus shifted elsewere.

The first thing I was thinking to try is to index CoValueRow.cacheKeys so we can get all the coValues related to a given cacheKey.

Perf wise it probably won't give us much, because the real "cost" lies on gathering the transactions, so we need to deal with that as well.

On the tx we could do the same as the CoValueRow and simply add a cacheKeys list in every single transaction, or figure out a way to do compaction of the tx rows.

We could go with a "append first" approach plus background compaction in a similar way I've done for the delete operation.

My intuition tells me that for the tx we probably need compaction, because managing the cacheKeys updates on the transactions store might be too much.

Also for compaction we can try to reduce the I/O by applying gzip compression on the logs and see if it helps with performance or not.

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.

2 participants