If an application running on Supabase with Supavisor ONLY uses serverless functions, it will have N max clients.
It isn't clear exactly how exactly each of the N max clients are taken/made available upon each action in an application.
In session mode, will a single serverless function use up 1/N clients for the entirety of its lifetime? In other words, does it use a single connection once it is invoked until it goes back to a cold state (but does not require connecting more than once for multiple queries in the same function invocation, or even for subsequent invocations)?
In transaction mode, does that mean that you effectively have a budget of N concurrent database queries, regardless of how many functions are active/invoked at any given moment? For instance, assume a serverless function that makes a single DB query then sleeps for 10m. If I invoke this function N times in parallel, does that imply that the budget of max clients is:
At time of all functions making DB query → 0/N
The moment all functions finish the query → N/N
The entire duration of the 10m function → N/N
If I then decide to invoke that same function N more times while the initial invocations are all sleeping for 10m, I could do so since the connection to the DB is broken the moment the query completes?
How exactly this works isn't documented clearly.
Describe the improvement
Provide more clear explanation for how each mode works for Supavisor.
Improve documentation
Link
https://supabase.com/blog/supavisor-postgres-connection-pooler
Describe the problem
If an application running on Supabase with Supavisor ONLY uses serverless functions, it will have N max clients.
It isn't clear exactly how exactly each of the N max clients are taken/made available upon each action in an application.
In session mode, will a single serverless function use up 1/N clients for the entirety of its lifetime? In other words, does it use a single connection once it is invoked until it goes back to a cold state (but does not require connecting more than once for multiple queries in the same function invocation, or even for subsequent invocations)?
In transaction mode, does that mean that you effectively have a budget of N concurrent database queries, regardless of how many functions are active/invoked at any given moment? For instance, assume a serverless function that makes a single DB query then sleeps for 10m. If I invoke this function N times in parallel, does that imply that the budget of max clients is:
How exactly this works isn't documented clearly.
Describe the improvement
Provide more clear explanation for how each mode works for Supavisor.