Don't give Postgres too much memory (even on busy systems)
vondra.me·4d
⚙️Systems Programming
Preview
Report Post

A couple weeks ago I posted about how setting maintenance_work_mem too high may make things slower. Which can be surprising, as the intuition is that memory makes things faster. I got an e-mail about that post, asking if the conclusion would change on a busy system. That’s a really good question, so let’s look at it.

To paraphrase the message I got, it went something like this:

Lower maintenance_work_mem values may split the task into chunks that fit into the CPU cache. Which may end up being faster than with larger chunks.

However, what if the system is busy? Doesn’t the likelihood of the operation (e.g. CREATE INDEX) fitting into the CPU cache decrease significantly on a busy system? Couldn’t that chan…

Similar Posts

Loading similar posts...