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
  1. function has cold start - db connection is now made
  2. db query #1 runs
  3. sleep 5s
  4. db query #2 runs
  5. function returns 200 status, but is alive and holding onto a connection for the remainder of the time that the function is "hot"
Transaction Mode
  1. function has cold start - no db connection
  2. db query #1 runs and creates a single db connection. as soon as query returns, connection is dropped
  3. sleep 5s
  4. db query #2 runs and creates a single db connection. as soon as query returns, connection is dropped
  5. 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
https://supabase.com/docs/guides/database/connecting-to-postgres#how-connection-pooling-works
IMG_3782.png
Explore the options for connecting to your Postgres database.
Was this page helpful?