Don't give Postgres too much memory
vondra.me·10h·
Discuss: Hacker News
Flag this post

From time to time I get to investigate issues with some sort of a batch process. It’s getting more and more common that such processes use very high memory limits (maintenance_work_mem and work_mem). I suppose some DBAs follow the logic that “more is better”, not realizing it can hurt the performance quite a bit.

Let me demonstrate this using an example I ran across while testing a fix for parallel builds of GIN indexes. The bug is not particularly interesting or complex, but it required a fairly high value for maintenance_work_mem (the initial report used 20GB).

To validate a fix, I ran the CREATE INDEX for a range of maintenance_work_mem values, and with different numbers of parallel workers. The goal was to check if some of those still fail, but I also measured t…

Similar Posts

Loading similar posts...