The following table explains the output in detail:

OutputDescription
worker_idThe id of the worker running the process.
idThe id of the process.
userThe username associated with the process.
hostThe host to which the client is connected.
databaseThe database if one is selected.
timeThe elapsed time since the running sql.
infoThe statement being executed.

This command only shows the frontend received processlist now.

Syntax

SHOW PROCESSLIST;

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

KILL id;

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)