
pgwd: A Watchdog for Your PostgreSQL Connections
Stop guessing when your database is about to run out of connections. You’ve seen it before: an app starts failing with "sorry, too many clients already" , and you only notice when users complain. By then, the database is saturated, and even your admin tools can’t connect. pgwd (Postgres Watch Dog) is a small Go CLI that watches your connection counts and alerts you before you hit the limit—and when you can’t connect at all. The problem PostgreSQL has a max_connections limit. When you exceed it: New connections are rejected with FATAL: sorry, too many clients already (SQLSTATE 53300) . If your app uses a superuser (or a role that can use all slots), even DBA access can be blocked unless you’ve reserved slots with superuser_reserved_connections . Without something watching connection usage, you only find out when things are already broken. How pgwd fits in: it watches your Postgres and pushes alerts to Slack and/or Loki when thresholds are exceeded or the connection fails. The idea: watc
Continue reading on Dev.to
Opens in a new tab




