Which of the following two is more accurate?
select numbackends from pg_stat_database; select count(*) from pg_stat_activity;
Number of TCP connections will help you. Remember that it is not for a particular database
netstat -a -n | find /c "127.0.0.1:13306"