Tuesday, February 23, 2016

Postmaster & Shared Memory



From the diagram, we can see Postmaster.

This is the process which starts when you start your database instance. When a postmaster starts the shared memory for the server is allocated to the Postmaster.

It Listens for any and all calls to the database.  When it receives a call from a client, it creates a back-end process (postgres server) to match it, using 1-1 correspondence.
Once the process is created, it links the client and postgres process so that they no longer have to communicate through the postmaster

Also, you can see that the shared memory contains: Shared Buffers, WAL Buffers and Process Array.

Shared buffers are used for reading and writing of the data from the data files.
When you read or write the content to a table and you commit the same, it goes to the data files. It all happens thru the shared buffers area.

Similarly, the transactions will go thru the WAL buffers area. WAL stands for write ahead log also called as transaction log in Postgres.

So when you write it goes to the WAL buffers and then goes to the WAL segments.
Process array stores the data of the different processes and the activity going thru these processes.

No comments:

Post a Comment