I have a scenario in which a deadlock occurred following an unusual increase in Number of Active Connections to the database.
In an hour, the Active Connection shooted up to 250 from 1 and it came back to normal by the end of the hour. At that time the deadlock occurred. Deadlock information contains a relation id and two pids, both of them are NOT traceable.
My guess would be that the deadlock caused the spike in connections, not the other way around.
Now I want to analysed what would have caused an unsual number of increase in the number of Active Connections, I can't get any data out of pg_stat_activity. Now the total number of connections is 75 only. Will there be any log from which I can get those queries or connection details?
If you have log_connections enabled you will find client connections logged in PostgreSQL's log file.