Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sqILn-008WEx-Fp for pgsql-general@arkaria.postgresql.org; Mon, 16 Sep 2024 20:29:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sqILm-00HPPX-Tg for pgsql-general@arkaria.postgresql.org; Mon, 16 Sep 2024 20:29:34 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sqILm-00HPPN-IQ for pgsql-general@lists.postgresql.org; Mon, 16 Sep 2024 20:29:34 +0000 Received: from smtp88.ord1d.emailsrvr.com ([184.106.54.88]) by magus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sqILe-001XMj-SO for pgsql-general@lists.postgresql.org; Mon, 16 Sep 2024 20:29:33 +0000 X-Auth-ID: xof@thebuild.com Received: by smtp20.relay.ord1d.emailsrvr.com (Authenticated sender: xof-AT-thebuild.com) with ESMTPSA id 0C1CAC0247; Mon, 16 Sep 2024 16:29:25 -0400 (EDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.600.62\)) Subject: Re: IO related waits From: Christophe Pettus In-Reply-To: Date: Mon, 16 Sep 2024 13:28:55 -0700 Cc: pgsql-general Content-Transfer-Encoding: quoted-printable Message-Id: References: To: veem v X-Mailer: Apple Mail (2.3774.600.62) X-Classification-ID: ac8d08f0-0256-456d-b292-30d7343a6b28-1-1 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Sep 16, 2024, at 13:24, veem v 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?=20 "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.=