I have a machine, let's call it DB_server
,
which is connected to two application machines,
let's call them application_server_1
and application_server_2
.
DB_server
hosts 3 postgres databases on it,
the name of one of it is centraldb
,
and the name of one of the users of this db is central
.
On DB_server
, by using htop
, I found out there are some processes run by postgres
user, associated to some postgres commands (which - if I guess right - are being run by the application_server_2
connecting to server_DB
and connecting to the database centraldb
with user central
), which consumes a lot of CPU.
Given the following output from htop
, indicating which is the process consuming a lot of CPU, how can I find out which are the queries which are running on those connections, and thus consuming the CPU of DB_server
?
PID USER ... Command
<pid_1> postgres ... postgres: 10/central centraldb <IP_application_server_2>(<pid_2>) idle