by orf · 11y ago · 0 comments
I've been thinking that a "test-only" mode of Postgres would be quite useful - i.e no persistence/WAL/crash-safety at all, in return for raw speed. My tests don't need any of this, and the Django test runner is awfully wasteful when it comes to setting up and tearing down tests.
Yes, the new toggle is much more convenient, but you do not have to wait for 9.5 if you really want it.
In our case, we converted some tables we use as kind of materialized views the moment 9.1 came out.
edit: fixed autocorrect wittyness (unclogged => unlogged)
I was also suggesting something further than unlogged tables, maybe something completely in-memory? Good tests are run in isolation and are really just care about the constraints rather than any form of persistence, combined with the fact that all data inserted is erased at the end of the test anyway it just seems a bit wasteful.
> Placing a tablespace on a temporary file system like a ramdisk risks the reliability of the entire cluster
Are you sure putting your test db on a ramdisk won't destroy the development db too?
So this is really just a convenient syntax.
https://groups.google.com/d/msg/django-developers/IkRgMxTTzP...
I think the performance gained varies quite a bit. I gave it a quick try and saw very minimal gains locally... still need to look into it some more.
You can also turn off fsync in postgresql.conf to stop fsyncs for transactions/checkpoints.