Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Increase database work_mem to 20MB #1744

Merged
merged 1 commit into from
Mar 20, 2022

Commits on Mar 20, 2022

  1. Increase database work_mem to 20MB

    When troubleshooting production outages due to 100% CPU usage we use pgbadger to
    analyze and inspect the database logs. In the report of temp file usage there
    were some queries that produced temp files over 4MB in size, the default working
    memory setting for Postgres. The largest temp file we saw in our logs was just
    over 16MB so in this commit we increase the working memory to 20MB in an attempt
    to have all queries run in memory without spilling onto disk, which is
    expensive.
    
    The RDS parameter group value for `work_mem` is specified in KB, so we use a
    value of 20000.
    
    Our database free memory graph always remains stable at at over 2.3GB and we
    have fewer than ten simultaneous connections to the database at any given time
    so we do not expect this increase in working memory to cause a free memory
    issue.
    jwalgran committed Mar 20, 2022
    Configuration menu
    Copy the full SHA
    8fad3dc View commit details
    Browse the repository at this point in the history