4 ms·
Cloning a template is IO-heavy. You can speed it up further by putting postgres on a ramdisk.
by hugodutka 2mo ago
Cloning a template is IO-heavy. You can speed it up further by putting postgres on a ramdisk.
- ltbarcly3 2mo agoJust turning off fsync is basically just as fast as a ramdisk and you can't use up all your memory with one big test.
- koolba 2mo agoTurning off synchronous_commit gets you most of the way without ever worrying about data corruption if something crashes mid way through. https://www.postgresql.org/docs/current/wal-async-commit.html https://www.postgresql.org/docs/current/wal-async-commit.htm...
- leontrolski 2mo agoAgreed, benchmarking, I only see a slight speedup on MacOS - https://github.com/leontrolski/postgresql-testing#:~:text=ramdisk https://github.com/leontrolski/postgresql-testing#:~:text=ra...
- brandur 2mo agoPeter actually makes this exact point in the project's README. See this section here: https://github.com/peterldowns/pgtestdb#how-do-i-make-it-go-faster https://github.com/peterldowns/pgtestdb#how-do-i-make-it-go-... I'd just say that a nice thing about it on disk (even if you disable fsync) is that in case of a failing test, you can examine the post-run state which is occasionally extremely valuable.
- peterldowns 2mo agoYup! If you keep your laptop on, failing dbs are investigable on tmpfs too — works fine for debugging a few tests in a loop, just can’t run the tests, sleep the computer, have lunch, and come back.
- brandur 2mo agoAh yep, good point. I was confusing "ramdisk" versus just "ephemeral in-memory".