Skip to main content
3 of 3
edited tags
Hannah Vernon
  • 70.5k
  • 22
  • 177
  • 321

Monitoring real-time statistics on PostgreSQL

I need to monitor the DB performance on a distributed system with multiple databases. Some of the database servers use pgbouncer to pool connections and in those servers I can connect to pgbouncer and execute a SHOW STATS; command to retrieve certain statistics, I'm interested in the following:

 avg_req | avg_recv | avg_sent | avg_query
------------------------------------------
     563 |  1080453 |  2060908 |     57718

The columns means:

  • avg_req
    Average requests per second in last stat period.
  • avg_recv
    Average received (from clients) bytes per second.
  • avg_sent
    Average sent (to clients) bytes per second.
  • avg_query
    Average query duration in microseconds.

Now my question is, is there a way of gathering this information without using pgbouncer on a postgresql server?