DEV Community

Chiazam Ochiegbu
Chiazam Ochiegbu

Posted on

Posgresql Optimization Techniques

Performance of a database can be impacted by both internal factors and external factors. Internally, database settings and structure, indexing design and implementation, they all affect the database performance in one way or another.
Externally, the physical database design like data file and log file distribution, underlying operating system, they can also form unexpected bottle neck if not well
configured.

Database Configuration Optimization

In Postgres configuration settings, there are many parameters affecting the performance of the database system
The default configuration in Postgres is meant for wide compatibility instead of high availability. So if running
default installation without tuning necessary parameter, the Postgres database system cannot benefit much from system resource.
Most tunable parameters are in a file called postgresql.conf which is located under Postgres data directory.

max_connections

This number determines the maximum number of concurrent connections allowed in Postgresql database server. The default setting is normally 100 connections, but could be less depending on the operating system‟s kernel settings. Since every time when opening a new connection will cause some overhead to the database and bears a part of shared memories, it is not encouraged to set this number higher than actually needed. If more than a thousand concurrent connections are needed, it is recommended to use connection pooling software to reduce overhead.

In the next article, we will consider shared_buffers which is another important parameter we can tune.

Top comments (0)