Technology Insights

Postgres Table pg_stat_activity Table Fields Explained

The pg_stat_activity table will show you what activity is currently happening on your PostgreSQL database server. The information will detail the database the activity is occuring on, the username initiating the activity, the length of time the acitivy has been occuring for, and much more.

Below is example output from running a SELECT query against the pg_stat_activity table. The pg_stat_activity table is located by default in the postgres database and can be accessed as shown below.

Technology Insights

PostgreSQL 8.3: postgres wont start with stats_start_collector = on

PostgreSQL 8.3 changed the way the Query and Index Statistics are configured from previous versions of postgreSQL including 8.2 and below. Things are technically easier now as the stats collecting is turned on by default and there are less commands to enter into the configuration to get all of the stats you will need. I had to look into this problem as I wanted to install some cacti postgres templates and the configuration stated to add the following lines to the postgresql.conf configuration file.