On starting with the Postgres database, it is normal to find many instances of postgres.exe listed in Windows Task Manager.
PostgreSQL is process-based, so it starts one postgres.exe on Windows instance per connection. The postmaster (which accepts connections and starts new Postgres instances for them) is always running. In addition, PostgreSQL generally has one or more "helper" processes like the stats collector, background writer, auto vacuum daemon, walsender, etc, all of which show up as "Postgres" instances. In attached screenshot, I selected a few additional columns ('command line' in particular) in the task manager and found that although these processes showed up as postgres.exe they were actually backend processes (identified with -for backend under the 'command line' column of task manager) or boot processes (identified with -forkboot) or the log process (identified with -forklog) etc.
Despite the number of processes, they actually use very little in the way of real resources.
Each postgres.exe attaches to a shared memory area. This means that you could be using 2 GB of memory (total) for your postgres database, when it looks like you're using 20 GB of memory. (10 backends all showing 2 GB each). The reality is... you're not using (mem * num of postgres.exe)
Comments
2 comments
Hi! thank you for the article. Is there a way to know when it becomes unormal to have so many backend processes ? We have around 30 backend processes without doing anything in Data360, is this still an expected behavior ?
Kind regards,
Sebastien
Hi Sebastien,
This is normal behavior, PostgreSQL uses a multi-process architecture. All of the processes are just how postgres works, It enables the database to do parallel processing on queries. Each process when idle should sit at around the 2MB mark. When processing queries they will spike in CPU and memory usage, but then will go down to the idle mark.
The idea behind this seems to be that if a process dies, it won’t take all other processes with it. To avoid if one thread crashes which would then cause the whole application to crash.
Is performance being impacted in any way?
Thanks and Regards,
Vikrant Kishore
Please sign in to leave a comment.