The following table explains the output in detail:
Output | Description |
---|
worker_id | The id of the worker running the process. |
id | The id of the process. |
user | The username associated with the process. |
host | The host to which the client is connected. |
database | The database if one is selected. |
time | The elapsed time since the running sql. |
info | The statement being executed. |
This command only shows the frontend received processlist now.
Syntax
Example
SHOW PROCESSLIST;
------RESULT
Worker Id | Id | User | Host | Database | Time | Info
-----------+-----+------+-----------------+----------+--------+-----------------------
2 | 2:0 | root | 127.0.0.1:50447 | dev | 4114ms | SELECT pg_sleep(3600)
3 | 3:1 | root | 127.0.0.1:50457 | dev | 6ms | SHOW PROCESSLIST
3 | 3:0 | root | 127.0.0.1:50453 | dev | 2844ms | SELECT pg_sleep(3600)
(3 rows)
Terminate the process
After using the SHOW PROCESSLIST
command to display the running processes, you can terminate them by the KILL
command.
Syntax
Example
SHOW PROCESSLIST;
------RESULT
Worker Id | Id | User | Host | Database | Time | Info
-----------+-----+------+-----------------+----------+--------+-----------------------
2 | 2:0 | root | 127.0.0.1:50447 | dev | 4114ms | SELECT pg_sleep(3600)
3 | 3:1 | root | 127.0.0.1:50457 | dev | 6ms | SHOW PROCESSLIST
3 | 3:0 | root | 127.0.0.1:50453 | dev | 2844ms | SELECT pg_sleep(3600)
(3 rows)
KILL '2:0';
------RESULT
KILL
KILL '3:0';
------RESULT
KILL
SHOW PROCESSLIST;
------RESULT
Worker Id | Id | User | Host | Database | Time | Info
-----------+-----+------+-----------------+----------+------+------------------
2 | 2:0 | root | 127.0.0.1:50447 | dev | |
3 | 3:1 | root | 127.0.0.1:50457 | dev | 2ms | SHOW PROCESSLIST
3 | 3:0 | root | 127.0.0.1:50453 | dev | |
(3 rows)