Server Settings

Kernel Parameters

Shared Memory

From the documentation:

The default maximum segment size is 32 MB, and the default maximum total size is 2097152 pages. A page is almost always 4096 bytes except in unusual kernel configurations with "huge pages" (use getconf PAGE_SIZE to verify).

The shared memory size settings can be changed via the sysctl interface. For example, to allow 16 GB:

In addition these settings can be preserved between reboots in the file /etc/sysctl.conf. Doing that is highly recommended. (DTS: Better would be /etc/sysctl.d/00-postgresql.conf)The remaining defaults are quite generously sized, and usually do not require changes.

NUMA

I/O

noop scheduler works well for RAID or SSD.

Deadline I/O scheduler is widely used for all database services, as it enforces latency limits over all I/O requests. I/O is done in batches, and we can tune the batch size and expire timings using the following parameters: