public inbox for [email protected]  
help / color / mirror / Atom feed
From: Christophe Pettus <[email protected]>
To: veem v <[email protected]>
Cc: pgsql-general <[email protected]>
Subject: Re: IO related waits
Date: Mon, 16 Sep 2024 13:28:55 -0700
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAB+=1TWZNvMhVthJ2iKs_Q4qBzMw-v_oaSz7HbFE_P_qC5jMFA@mail.gmail.com>
References: <CAB+=1TWZNvMhVthJ2iKs_Q4qBzMw-v_oaSz7HbFE_P_qC5jMFA@mail.gmail.com>



> On Sep 16, 2024, at 13:24, veem v <[email protected]> wrote:
> Architecture team is suggesting to enable asynch io if possible, so that the streaming client will not wait for the commit confirmation from the database. So I want to understand , how asynch io can be enabled and if any downsides of doing this? 

"Async I/O" has a specific meaning that's not currently applicable to PostgreSQL.  What is available is "synchronous_commit".  This setting is by default on.  When it's on, each commit waits until the associated WAL information has been flushed to disk, and then returns.  If it is turned off, the commit returns more or less immediately, and the WAL flush happens asynchronously from the commit.

The upside is that the session can proceed without waiting for the WAL flush.  The downside is that on a server crash, some transactions may not have been fully committed to the database, and will be missing when the database restarts.  The database won't be corrupted (as in, you try to use it and get errors), but it will be "earlier in time" than the application might expect.  It's pretty common to turn it off for high-ingestion-rate situations, especially where the application can detect and replay missing transactions on a crash.





view thread (7+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: IO related waits
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox