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 1sqdyo-00BTSt-FF for pgsql-general@arkaria.postgresql.org; Tue, 17 Sep 2024 19:35:19 +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 1sqdyn-00FInx-HS for pgsql-general@arkaria.postgresql.org; Tue, 17 Sep 2024 19:35:17 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sqdyn-00FIlV-21 for pgsql-general@lists.postgresql.org; Tue, 17 Sep 2024 19:35:17 +0000 Received: from mail-lf1-x136.google.com ([2a00:1450:4864:20::136]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sqdyj-001gbh-Qu for pgsql-general@lists.postgresql.org; Tue, 17 Sep 2024 19:35:15 +0000 Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-5356ab89665so6720991e87.1 for ; Tue, 17 Sep 2024 12:35:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726601712; x=1727206512; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=5lMGjpAARlLjRh2uRlNi0MIITiRQ13GT1o7+KQ5zNl8=; b=c7qRyweDR1AHh9crEumfmS6ziBi+xxcwpJGVnnvIaf7AbUecueLvo04oPa3tY9TipW ndxxf4iTizKebirfTbMFdv38dlKdazQdQldPfxfIY1ULWt2WpETDR2Tsn6YiN65Z6j2k wUKkcCBQR/f7nHqT70QnzPC3pVL7ixrKd2Z6fkCvTHJm/4M8FEjWwptCrpqz5w1UULYF TVBZsiE6HitezBlvxEp4YXp8lRVDPyabW4mtCjBFnuEuP0uJEzBJHXRMTkF6y9JuLG9E cqTM/dOR+h5FkrdAOlrkSjpjrev3sDaqTw9T0zZzyV4Wqz06zbRHhpKfz7PZGAkf4yFH qF/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726601712; x=1727206512; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=5lMGjpAARlLjRh2uRlNi0MIITiRQ13GT1o7+KQ5zNl8=; b=ZOs5Wrl1v12ei4pbfoLtceLPIcNdoJfddDGTtypdJTHoKZK4lXgVHdzmTPIVLCm0w2 SxcrQK1h0+6hXOt5m4MA7nP9vWoUES8jA/jTfyyg9pc4FFtDA2mpA9p7WGCqAvoAIh0l LYk11dnildVag4YsImcPXY9N1j+6LP6236jhvQcxNzHNXJBhSG0zM4kCQ3p3QvEgvzFq 7OE1UevZ9iPRS2ttXghByAHmPMi+0cki+rwlp+3vbJ+WQlJSS+TT/VnyLgbasp+gM0Jm VzOvp85nB93N4pVubWkj6fDCzRLbUpp0zfSmOWJOSVUbVY1BhqrsIuTP5JJe4Za6+Yet GJ0g== X-Forwarded-Encrypted: i=1; AJvYcCUscECMMn6NZmcUEDo6/sPqyp3xDv1biJB8DsrEek+fTUHzRA7Wm7kInxzEEuG5Pt/EEiKFRXiAa0k843zi@lists.postgresql.org X-Gm-Message-State: AOJu0YxejFDxE3W2JKBP/+m63F4nqOWYlDTQ3oWqSzFgcd62O3+6vDhT gO6kXU4uSYSNSluwjpzq5IBgR9eN6CbfIr6D9myVq09/xXWlTVj7rZnlVQftnvTi9p6Wr0nglWj atRg7ZnCnNzrXIFlI48P0sEPgCnc= X-Google-Smtp-Source: AGHT+IGHRLcuNbt+qZEwMr6TIOcBOzfHlFlHcuSlDxWN2pdIaujgMgv6UeUdzB2nYWy9CnUcpE3lsVp0YH4wt2ydgsI= X-Received: by 2002:a05:6512:12ca:b0:530:ad7d:8957 with SMTP id 2adb3069b0e04-53678ff325amr10888301e87.49.1726601711904; Tue, 17 Sep 2024 12:35:11 -0700 (PDT) MIME-Version: 1.0 References: <3dddea5e-52ab-4075-970d-a87b0c921ae7@aklaver.com> <225d1bc1-5117-4c72-85a1-bac6355fb659@aklaver.com> In-Reply-To: <225d1bc1-5117-4c72-85a1-bac6355fb659@aklaver.com> From: veem v Date: Wed, 18 Sep 2024 01:04:59 +0530 Message-ID: Subject: Re: IO related waits To: Adrian Klaver , Greg Sabino Mullane Cc: Christophe Pettus , pgsql-general Content-Type: multipart/alternative; boundary="000000000000b4f572062255c9dc" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000b4f572062255c9dc Content-Type: text/plain; charset="UTF-8" On Tue, 17 Sept 2024 at 21:24, Adrian Klaver wrote: > > Which means you need to on Flink end: > > 1) Use Flink async I/O . > > 2) Find a client that supports async or fake it by using multiple > synchronous clients. > > On Postgres end there is this: > > https://www.postgresql.org/docs/current/wal-async-commit.html > > That will return a success signal to the client quicker if > synchronous_commit is set to off. Though the point of the Flink async > I/O is not to wait for the response before moving on, so I am not sure > how much synchronous_commit = off would help. > > Got it. So it means their suggestion was to set the asynch_io at flink level but not DB level, so that the application will not wait for the commit response from the database. But in that case , won't it overload the DB with more and more requests if database will keep doing the commit ( with synchronous_commit=ON) and waiting for getting the response back from its storage for the WAL's to be flushed to the disk, while the application will not wait for its response back(for those inserts) and keep flooding the database with more and more incoming Insert requests? Additionally as I mentioned before, we see that from "pg_stat_database" from the column "xact_commit" , it's almost matching with the sum of "tup_inserted", "tup_updated", "tup_deleted" column. And also we verified in pg_stats_statements the "calls" column is same as the "rows" column for the INSERT queries, so it means also we are inserting exactly same number of rows as the number of DB calls, so doesn't it suggest that we are doing row by row operations/dmls. Also after seeing above and asking application team to do the batch commit ,we are still seeing the similar figures from pg_stat_database and pg_stat_statements, so does it mean that we are looking into wrong stats? or the application code change has not been done accurately? and we see even when no inserts are running from the application side, we do see "xact_commit" keep increasing along with "tup_fetched" , why so? Finally we see in postgres here, even if we just write a DML statement it does commit that by default, until we explicitly put it in a "begin... end" block. Can that be the difference between how a "commit" gets handled in postgres vs other databases? --000000000000b4f572062255c9dc Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

On Tue, 17 Sept 2024 at 21:24, Adrian Kla= ver <adrian.klaver@aklaver.= com> wrote:

Which means you need to on Flink end:

1) Use Flink async I/O .

2) Find a client that supports async or fake it by using multiple
synchronous clients.

On Postgres end there is this:

https://www.postgresql.org/docs/current= /wal-async-commit.html

That will return a success signal to the client quicker if
synchronous_commit is set to off. Though the point of the Flink async
I/O is not to wait for the response before moving on, so I am not sure
how much synchronous_commit =3D off would help.

=C2=A0Got it. So it means their suggestion was to set the asyn= ch_io at flink level but not DB level, so that the application will not wai= t for the commit response from the database. But in that case , won't i= t overload the DB with more and more requests if database will keep doing t= he commit ( with synchronous_commit=3DON)=C2=A0 and waiting for getting the= response back from its storage for the WAL's to be flushed to the disk= , while the application will not wait for its response back(for those inser= ts) and keep flooding the database with more and more incoming Insert reque= sts?

Additionally as I mentioned before, we see th= at from "pg_stat_database" from the column "xact_commit"= ; , it's almost matching=C2=A0with the sum of "tup_inserted",= "tup_updated", "tup_deleted" column. And also we verif= ied in pg_stats_statements the=C2=A0 "calls" column is same as th= e "rows" column for the INSERT queries, so it means also we are i= nserting exactly same number of rows as the number of DB calls, so doesn= 9;t it suggest that we are doing=C2=A0row by row operations/dmls.

Also after seeing above and asking application team to do t= he batch commit ,we are still seeing the similar figures from pg_stat_datab= ase and pg_stat_statements, so does it mean that we are looking into wrong = stats? or the application code change has not been done accurately? and we = see even when no inserts are running from the application side, we do see &= quot;xact_commit" keep increasing along with "tup_fetched" ,= why so?

Finally we see in postgres here, even if = we just write a DML statement it does commit=C2=A0that by default, until we= explicitly put it in a "begin... end" block. Can that be the dif= ference between how a "commit" gets handled in postgres vs other = databases?


--000000000000b4f572062255c9dc--