Skip to content

Repository: postgresql

  • Set Retain policy to Retained
  • Make sure there is double free space in the storage
  • Add new instance (with desired size)
  • Check if replicas are done via select * from pg_stat_replication;
  • Remove old instance
  • Use connection pool (pgBouncer)
  • Create a manager user with idle_session_timeout set to 5m using command
set idle_session_timeout to 300000;
ALTER ROLE manager SET idle_session_timeout = 300000; (to specific role)
  • Monitor connections using
SELECT sum(numbackends) FROM pg_stat_database;
SELECT * FROM pg_stat_activity order by state_change;
show max_connections;
SELECT count(*), state FROM pg_stat_activity GROUP BY 2;
SHOW idle_session_timeout;