Need help determining connection pooling issues
I've been looking into supabase, specifically supavisor. Attached are the metrics for supavisor. My application uses prisma with vercel serverless functions. I am trying to figure out if i am supposed to use session or transaction mode. if i have a serverless function that makes 2 queries, is this a correct understanding:
Session Mode
Session Mode
- function has cold start - db connection is now made
- db query #1 runs
- sleep 5s
- db query #2 runs
- function returns 200 status, but is alive and holding onto a connection for the remainder of the time that the function is "hot"
- function has cold start - no db connection
- db query #1 runs and creates a single db connection. as soon as query returns, connection is dropped
- sleep 5s
- db query #2 runs and creates a single db connection. as soon as query returns, connection is dropped
- function returns 200 status and is alive but is not holding onto a connection for the remainder of the time that the function is "hot" unless it gets called again

Explore the options for connecting to your Postgres database.