10

We are facing performance issue on Production Postgresql Database server which is hosted in AWS RDS server. So that we installed postgresql in EC2 instance Linux server for pre-production and tried with shared buffer value 15% of RAM value we get some positive response.

So that, Definitely we can assign shared buffer value 15% to 30 % of RAM value. But when i trying to resize shared buffer value in Production DB server which i hosted in AWS RDS. it says invalid parameter value. By default following value is assigned for shared buffer parameter. shared buffer = {DBInstanceClassMemory/32768}
Please help me to resize shared buffer value is min 15 % of RAM memory. My Instance specification is : 2 CPU, 7.5 GB RAM (db.m3.large).

1 Answer 1

17

If you want to set shared_buffers to 15% of RAM, put 147456 as value instead of {DBInstanceClassMemory/32768}...

shared buffers is set as number of 8kB blocks => calculating is such:

postgres=> select (15*7.5*1024*1024 /100)/8;
      ?column?
---------------------
 147456.000000000000
(1 row)

where:

  • 15 is 15%
  • 7.5 is 7.5 GB of RAM
  • 1024*1024 to convert GB to KB (to unify against shared_buffers units
  • 8 is 8kB

then you have to reboot your RDS instance and check value with:

show shared_buffers; in psql

4
  • 4
    I advise leaving the existing format and update the 32768 by 54613 (100/15*8*1024). It will be 15% even if you up or downgrade the instance class Commented Sep 21, 2020 at 8:05
  • 1
    Forgive my ignorance here, but wouldn't changing {DBInstanceClassMemory/32768} to {DBInstanceClassMemory/54613} change the percentage of cache memory available from 25% to 15% and therefore reduce database performance? Does the OP realize they're shrinking the cache?
    – sage88
    Commented Aug 19, 2022 at 20:10
  • I think I must be missing something obvious here, but why is DBInstanceClassMemory/32768 25% instead of, like 0.003%? Commented Oct 17, 2023 at 23:20
  • 1
    @AndrewRueckert The value is multiplied by 8192, so it's DBInstanceClassMemory/32768*8192 == DBInstanceClassMemory/4. Also one can only set an absolute value it seems, only AWS can calculate a value.
    – MKesper
    Commented Aug 6 at 10:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.