About Lesson
PostgreSQL is implemented using a simple “process per-user” client/server model. In this model, every client process is connected to exactly one server process.
PostgreSQL Connection string
You need to specify the following parameters to connect to PostgreSQL:
- Host or host address
- Port
- Database name
- User
- Password (or other means of authentication, if any)
Example., psql -U <username> -d <database name>
Step by Step:
- The client process requests the master server process called the POSTMASTER process for a connection to the database instance.
- The postmaster process creates a new backend process called the PostgreSQL process after the authentication check is done and if everything is fine, the connection is created.
- The postmaster process will then assign the newly created backend process to the client process.
- Once a connection is established the client process can send a query to the backend (server). The query is transmitted using plain text, i.e., there is no parsing done in the frontend (client).
- The server parses the query, creates an execution plan, executes the plan and returns the retrieved rows to the client by transmitting them over the established connection
Further reading here