Schedule - PostgreSQL Development Conference 2025

Changing shared_buffers on the fly

Date: 2025-05-15
Time: 09:00–09:50
Room: Breakout Room 3
Level: Intermediate

Out of all PostgreSQL configuration parameters that affects performance, shared_buffers is arguably one of the most important. But in order to change its value, the database needs to be restarted, meaning that adjusting shared_buffers in response to a dynamically changing load becomes tricky. For example you might have strict requirements on high availability that are not allowing that, or you want to find the optimal value algorithmically and have to change this configuration very frequently. As a result, users tend to settle down on a non optimal value and pay the price in performance or money, getting frustrated either way.

After pondering about this for a while and having discussed this on pgsql-hackers, it seems we found out how to improve the situation, allow changing shared_buffers at runtime without requiring a restart and modernize the way PostgreSQL works with shared memory overall. In this talk we would like to discuss the proposed solution [1], covering topics like:

  • Reserving shared mapping address space.
  • Utilize multiple shared memory mappings.
  • How to remap shared memory and keep addresses unchanged.
  • Why anonymous files could be useful.
  • What are the potential caveats with synchronization between backends, and how to avoid them.
  • How does it affect performance.

[1] https://www.postgresql.org/message-id/cnthxg2eekacrejyeonuhiaezc7vd7o2uowlsbenxqfkjwgvwj@qgzu6eoqrglb

Speaker

Ashutosh Bapat
Dmitrii Dolgov