PostgreSQL 8.3 and asynchronous commits

93 views
Skip to first unread message

Jeremy Dunck

unread,
Oct 21, 2007, 3:07:43 AM10/21/07
to django-d...@googlegroups.com
This sounds quite tasty:
http://developer.postgresql.org/pgdocs/postgres/wal-async-commit.html

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?

Jacob Kaplan-Moss

unread,
Oct 21, 2007, 10:30:49 AM10/21/07
to django-d...@googlegroups.com
On 10/21/07, Jeremy Dunck <jdu...@gmail.com> wrote:
>
> This sounds quite tasty:
> http://developer.postgresql.org/pgdocs/postgres/wal-async-commit.html
>
> I'd like to add support for that.

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.

Reply all
Reply to author
Forward
0 new messages