I'd like to add support for that.
Obviously only for postgres and 8.3, but perhaps with a setting to
turn it on or off depending on the site's needs?
I think trying to implement or modify a transaction decorator for it
might be past 80/20.
Thoughts?
In reality, async. commit is something you'd turn on in your
postgresql.conf and just leave on; there isn't really any gain to
flipping it on and off in userland. The "risk" of running with async.
commit on is literally negligible[*].
However, it's prett easy to do in user code if you need to::
>>> from django.db import connection
>>> c = connection.cursor()
>>> c.execute("SET synchronous_commit = 't'")
I'm -0 on exposing this directly: PostgreSQL has hundreds of run-time
settings that can be set in a similar manner; seems silly to treat one
of them differently.
Jacob
[*] The only risk is that a power failure between a commit and when
the change gets written to disk will cause data loss. The maximum size
of that data loss is going to be extremely small -- one WAL segment,
which is IIRC something around 32 transactions.