Adding swap to Postgres machines

Curious if anyone has tips for adding swap to Postgres machines. I have some jobs that occasionally make large queries, and once in a while those queries blow through RAM and I get OOM crashes on my Postgres primary. I’d like to allocate some swap because I’d rather degraded performance when this happens rather than a hard crash, but I can’t seem to find any documentation or examples for adding swap to Postgres machines. There’s plenty of examples for app machines but in the case of Postgres, with no Dockerfile entrypoint to configure anything in, I’m not sure exactly how to make sure every PG machine I spin up gets allocated swap.

Nevermind lol it’s as easy as adding

swap_size_mb = 1024

to the fly.toml for the cluster and then redeploying.

From How To to Questions / Help

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.