#One use query with reactive data that updates cost for one function call

3 messages · Page 1 of 1 (latest)

lavish rune
#

When dealing the the reactivity of convex. Client side using useQuery, every time the data updates and client side is automatically updated - each update is that a separate function call counting against pricing plan?

sturdy nexusBOT
#

Hi @lavish rune. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Yes, every time the data updates and the client is automatically updated via useQuery, each update is counted as a separate function call for billing purposes. This means that if you have a reactive query and the underlying data changes (for example, due to a mutation), Convex will re-execute the query and send the new result to all subscribed clients, and each of these updates is billed as a function call—even if the response is served from cache. This has been confirmed by Convex support staff in multiple discussions:

"Yes, every update is a function call. A large amount of this is typically cached, and the team has mentioned treating cached responses differently than non-cached for billing purposes in the future, but currently they're treated the same."
"Each individual subscribed client does make a function call when changes occur, so if you have a lot of users it's a lot of function calls."
Discord support thread: Does Convex count updates from query as function calls?

Additionally, cached function responses also count as function calls for billing, but they do not use bandwidth charges:

"Cached function responses only count as function calls."
Discord support thread: [billing] query cache hit counts towards billed function calls?

So, in summary: every automatic update triggered by useQuery due to data changes is a separate function call and is billed accordingly.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: