When I execute

ps aux | grep postgres

or top | grep postgres

I get all my postgres processes with some information, the last column (command) has the following structure:

postgres: username db ip_address(xxxxx) QUERY_TYPE

For example:

postgres: postgres test SELECT

What does this number means (33195)?

I'm having troubles with my database and I want to know if this information could help me. Some queries are taking too long.

It is some kind of process dependency?


According to the postgresql docs,

On most Unix platforms, PostgreSQL modifies its command title as reported by ps, so that individual server processes can readily be identified

It appears to me that the 33195 in your example is the port on the possibly-remote system that has connected with the postgres server. Confirm with something like netstat -an | grep 33195 .

Just found the git repository for postgresql where I traced the behavior to the DoBackend function, which updates the ps listing like this:

 * Set process parameters for ps
 * WARNING: On some platforms the environment will be moved around to
 * make room for the ps display string. So any references to
 * optarg or getenv() from above will be invalid after this call.
 * Better use strdup or something similar.
init_ps_display(real_argc, real_argv, port->user, port->database,

where remote_host was set earlier.

  • I might have stumbled onto the wrong git branch; see also this
    – Jeff Schaller
    Nov 10 '16 at 19:03

This site is temporarily in read only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .