Show running process in postgres
I mostly use the MySQL server and very much familiar with its commands and how it works.
Today I was checking How to check the running process in Postgresql. In MySQL we use
show processlist; command.
In Postgresql,to show running process in postgres use below given command
Step 1: Login with system user in postgresql server
Step 2: Switch to postgres user using below command
su -l postgres
Step 3: Login into Postgresql server now (When you use psql command bydefault it takes postgres user, if you want to use other username use this command
psql -U username database name -W )
After login with postgres user you will get the console like this postgres=#
Here we are using command to see running process is
select * from pg_stat_activity;
root@postgres-server:~# su -l postgres postgres@postgres-server:~$ psql Password: psql (9.1.9) Type "help" for help. postgres=# select * from pg_stat_activity;
Step 4: To stop showing process list press q key from your keyboard
Step 5: To exit from postgresql console use q, see below command how to do.
postgres=# q postgres@postgres-server:~$