How can I close connections after a query is done
When Hot-Reloading I get a bunch of extra connections, and eventually I run out of connections. This is on dev btw
This may not be cause by hot reload, i am unsure
when running
SELECT * FROM pg_stat_activity;
in Supabase
I see a bunch of connections that are running the same queries all from postgres.js even after the api call is done. The connections are then stuck on idle
3 Replies
Hot reloading causes this issue. The singleton is the solution
Doesn't the function
postgres(connectionString)
returns a pool? In that case it's normal to have idle connectionsoh alright so if i just use the pool it should be good?
That is my understanding, it has several connections available to make your queries start faster