Aps
Aps3w ago

Document in args VS db.get

Hi all! The topic is about passing documents as args between queries/mutations vs passing only the ids and fetching them from the db every time. I asked the AI in the docs and it recommended to pass the id, but I wanted to verify this with a human. I would imagine there are performance considerations here? Are there also pricing considerations? Thanks
3 Replies
Convex Bot
Convex Bot3w ago
Thanks for posting in <#1088161997662724167>. Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets. - Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.) - Use search.convex.dev to search Docs, Stack, and Discord all at once. - Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI. - Avoid tagging staff unless specifically instructed. Thank you!
Aps
ApsOP3w ago
I actually just read about how queries are cached. So I presume that if I try to get a document or run query that is cached, the performance would be excellent and I would incur no additional cost (runs) is that correct?
djbalin
djbalin2w ago
I asked something a bit similar to this here: https://discord.com/channels/1019350475847499849/1312007714121056317/1312007714121056317 Does not seem like there should be any downside to passing the actual documents as argument between functions (just make sure to stay under the limit for function argument size which, I believe, is 8 MB atm)

Did you find this page helpful?