Skip to content

Instantly share code, notes, and snippets.

@normoes
Last active June 15, 2023 08:36
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save normoes/7a737982bc87f28760903a8c7fb7c226 to your computer and use it in GitHub Desktop.
Save normoes/7a737982bc87f28760903a8c7fb7c226 to your computer and use it in GitHub Desktop.
AWS RDS PostgreSQL shared_buffers

Source: https://stackoverflow.com/questions/42478488/resize-shared-buffer-size-in-postgresql-hosted-in-aws-rds

To calculate the correct value for shared_buffers in a AWS RDS PostgreSQl database:

(2*1024*1024*12.5/100)/8)
# = 32768

The values:

  • 2*1024*1024
    • DB instance has 2 [GB] of RAM.
    • 1024*1024 converts GB to kB.
  • 12.5/100
    • 12.5 [%] of the RAM should be assigned to shared_buffers.
  • /8
    • Postgres works with blocks of 8 [kB] size.

So, if you would like to increase the value for shared_buffers to 25 [%] (instead of 12.5 [%]), you would want to have:

(2*1024*1024*25/100)/8)
# = 65536
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment