Hi Lejeczek, What are you using to control your cluster? If you are using patroni, you can use regex to grep the Leader or if you are not using any cluster manager you can do: SELECT Count(pid)) FROM pg_stat_activity WHERE wait_event IS NOT NULL AND backend_type = ‘walsender' The master will always have walsender process and the standby walreiver Regards, Emile
|