Using this recipe, we will get all the active sessions from a PostgreSQL instance, which are utilizing the server resources.
Like other database management systems, PostgreSQL is also providing a set of catalog tables and views, which will help us to retrieve the current instance status. In this recipe, we will be discussing a catalog view, which every DBA/developer queries very frequently.
postgres=# SHOW track_activities; track_activities ------------------ on (1 row)
pgbenchtest as follows:
$ pgbench -i; pgbench -c 4 -T 100 creating tables... 100000 of 100000 tuples ...