We sometimes get this error
ERROR: canceling statement due to statement timeout : SELECT and "unplugging and plugging back in" does the trick in terms of a fresh start, but I'd like to know more about dealing with this error in general.
It comes alongside errors like
PG::ConnectionBad: FATAL: remaining connection slots are reserved for non-replication superuser connections
I know this is a matter of resource constraints and how Postgres deals with it, but other than the hard reset I don't have a good grasp of dealing with the problem.
I have also adjusted the overall pool size in dealing with this, but I'm still not confident in some of the underlying mechanics at play.
What exactly is going on here and how should I approach the problem?