Discussion:
Forcing WAL flush
(too old to reply)
james
2013-01-07 21:49:42 UTC
Permalink
Is there a way to force a WAL flush so that async commits (from other
connections) are flushed, short of actually updating a sacrificial row?

Would be nice to do it without generating anything extra, even if it is
something that causes IO in the checkpoint.

Am I right to think that an empty transaction won't do it, and nor will
a transaction that is just a NOTIFY?
--
Sent via pgsql-performance mailing list (pgsql-***@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance
François Beausoleil
2013-01-07 21:55:39 UTC
Permalink
Is there a way to force a WAL flush so that async commits (from other connections) are flushed, short of actually updating a sacrificial row?
Would be nice to do it without generating anything extra, even if it is something that causes IO in the checkpoint.
Am I right to think that an empty transaction won't do it, and nor will a transaction that is just a NOTIFY?
Does pg_start_backup() trigger a full WAL flush?

http://www.postgresql.org/docs/9.2/static/continuous-archiving.html#BACKUP-LOWLEVEL-BASE-BACKUP
http://www.postgresql.org/docs/9.2/static/functions-admin.html#FUNCTIONS-ADMIN-BACKUP-TABLE

Bye,
François
--
Sent via pgsql-performance mailing list (pgsql-***@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance
james
2013-01-07 22:05:38 UTC
Permalink
Post by François Beausoleil
Is there a way to force a WAL flush so that async commits (from other connections) are flushed, short of actually updating a sacrificial row?
Would be nice to do it without generating anything extra, even if it is something that causes IO in the checkpoint.
Am I right to think that an empty transaction won't do it, and nor will a transaction that is just a NOTIFY?
Does pg_start_backup() trigger a full WAL flush?
http://www.postgresql.org/docs/9.2/static/continuous-archiving.html#BACKUP-LOWLEVEL-BASE-BACKUP
http://www.postgresql.org/docs/9.2/static/functions-admin.html#FUNCTIONS-ADMIN-BACKUP-TABLE
Bye,
François
That sounds rather heavyweight!

I'm looking for something lightweight - I might call this rather often,
as a sort of application-level group commit where I commit async but
defer the ack to the requester (or other externally visible side
effects) slightly until some other thread forces a flush.
--
Sent via pgsql-performance mailing list (pgsql-***@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance
Jeff Janes
2013-01-07 23:56:51 UTC
Permalink
Post by james
Is there a way to force a WAL flush so that async commits (from other
connections) are flushed, short of actually updating a sacrificial row?
Would be nice to do it without generating anything extra, even if it is
something that causes IO in the checkpoint.
Am I right to think that an empty transaction won't do it, and nor will a
transaction that is just a NOTIFY?
This was discussed in "[HACKERS] Pg_upgrade speed for many tables".

It seemed like turning synchronous_commit back on and then creating an
temp table was the preferred method to force a flush. Although I
wonder if that behavior might be optimized away at some point.

Cheers,

Jeff
--
Sent via pgsql-performance mailing list (pgsql-***@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance
Loading...