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 1sqaX8-00AzA6-Ri for pgsql-general@arkaria.postgresql.org; Tue, 17 Sep 2024 15:54:31 +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 1sqaX8-00CtgD-Dc for pgsql-general@arkaria.postgresql.org; Tue, 17 Sep 2024 15:54:30 +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 1sqaX8-00CteB-0r for pgsql-general@lists.postgresql.org; Tue, 17 Sep 2024 15:54:30 +0000 Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sqaX4-001fp2-6B for pgsql-general@lists.postgresql.org; Tue, 17 Sep 2024 15:54:29 +0000 Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-a8d6ac24a3bso1068947766b.1 for ; Tue, 17 Sep 2024 08:54:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726588466; x=1727193266; 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=4LKQcLUFAhgI77yXMvnF5PmuMOiTVz/+M6NmPey3mDc=; b=GCgjIDsz8aE+jUah6F6mkya/gaEFTCrCYp3dyabvKOhtiO4ssSojb1YJ1xzQa2OByJ MyB31oamYqbw4BrBlHJbOCGh7aAjz5QfBl2AMLVb0wmOJHVStrkC60jm0UcNhTFTh+X+ rMM4iN8ukA0liz+kan+WiaAgdidBE+dvUUI5zibVT5dRTF2P8m7PD90NHI/NW/CFsf7d hs1od3MTvqUEeDpaj/AoYaMUePKSHPbTuKouBXkmOeQaUf+Vdz3s/um9JC+WoxV91aD/ 9MBkhxeNN74/DaYibhBG6XxWiIOazjWzIYZBmRXx+xyO7df+uZPYozxt0h0T5jhvGpje epsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726588466; x=1727193266; 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=4LKQcLUFAhgI77yXMvnF5PmuMOiTVz/+M6NmPey3mDc=; b=Amwg02zd+KgX4K+0SqN2EriYPaa3q8Fm6VkioMbtfCVs7XU+/KqduMPGCiW2v46yZu 2tz0F2TqFKrGhhpvVDt7lEn+hsow9Fix4xpZJY0BYsP9xEBL+0ScYiLOYnEejnMvHNAa SuVpmey2L9yoL0HPozC2J4SN57OdWpWw9gqlbpJZvNDKwDW6q+C5qatvEN1dDgi+N8hB X1ukpStaG7AbMscaDHrWahK51ZfC8HLdpfk9km/mOGdYPfefyosy3zjNF2mQY5D4MeaS OULSv6aUP4klk2KOzuL0vPYi5EZGD2dRY8feRolawIJjLFCzFyW5NJ97UOCO3SvvHGXW qZLw== X-Forwarded-Encrypted: i=1; AJvYcCVCA2ZUz3DYFtY7f7vmG7rqGFrAYWOyuiUv1wVWct9M9dZ/n193AzXwfLNvCaSN0Y1GlN/QvPHJ9L7Ljdot@lists.postgresql.org X-Gm-Message-State: AOJu0YwUo6/vlWt11I9gpMxMau3JB7O7laLVr4l5huLzqx7yYe7mPi8E MmScWgx8styes5M3FLZGDznorM4oeUS1Yw1rgl8eQpAwYIsfAA4cc9/rjCbXv8SdS1bNuicdm6Q mo/X/ClEaEvsuXhT2rQbnErldC8obA5eg X-Google-Smtp-Source: AGHT+IEJDOC+JuIT84Xd0AxC7Jdii5H9oKzBYYBK7TgIbR2RIrZYCviokTLV2FDDJFY2ifNckFbNk9bk8mFmw8YtHoE= X-Received: by 2002:a17:907:1c90:b0:a8d:42ec:e65d with SMTP id a640c23a62f3a-a8ffaac08a0mr2630730766b.7.1726588466006; Tue, 17 Sep 2024 08:54:26 -0700 (PDT) MIME-Version: 1.0 References: <3dddea5e-52ab-4075-970d-a87b0c921ae7@aklaver.com> In-Reply-To: From: veem v Date: Tue, 17 Sep 2024 21:24:14 +0530 Message-ID: Subject: Re: IO related waits To: Greg Sabino Mullane Cc: Adrian Klaver , Christophe Pettus , pgsql-general Content-Type: multipart/alternative; boundary="000000000000308ffb062252b455" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000308ffb062252b455 Content-Type: text/plain; charset="UTF-8" On Tue, 17 Sept 2024 at 18:43, Greg Sabino Mullane wrote: > > This is a better place to optimize. Batch many rows per transaction. > Remove unused indexes. > > flushing of the WAL to the disk has to happen anyway(just that it will be >> delayed now), so can this method cause contention in the database storage >> side if the speed in which the data gets ingested from the client is not >> getting written to the disk , and if it can someway impact the data >> consistency for the read queries? >> > > Not quite clear what you are asking here re data consistency. The data > will always be consistent, even if synchronous_commit is disabled. The only > danger window is on a server crash. > > (Keep in mind that RDS is not Postgres, so take tuning recommendations and > advice with a grain of salt.) > > > Thank you Greg. Yes, our Java application was doing row by row commit and we saw that from pg_stat_database from the column "xact_commit" which was closely the same as the sum of tup_inserted, tup_updated, tup_deleted column. And also we verified in pg_stats_statements the number against the "calls" column were matching to 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 it also suggest that we are doing row by row operations/dmls. And we then asked the application tema to make the inserts in batches, but still seeing those figures in these above two views are not changing much the number "xact_commit" is staying almost same and also even the "calls" and the "rows" column in pg_stats_statements also staying almost same. So does it mean that the application code is somehow still doing the same row by row processing or we are doing something wrong in the above analysis? And another thing we noticed , even after the data load finished , even then the "xact_commit" was keep increasing along with "tup_fetched", so does it mean that its doing some kind of implicit commit even for the fetch type queries which must be "select" queries i believe? Also not sure if its expected, but here in postgres i have seen unless we put a code within begin and end block , it's default gets committed even we just run it on the console , it doesn't ask for a explicit commit/rollback ,so not sure if that is someway playing a role here. Regards Veem > > --000000000000308ffb062252b455 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

On Tue, 17 Sept 2024 at 18:43, Greg Sabin= o Mullane <htamfids@gmail.com&= gt; wrote:

This= is a better place to optimize. Batch many rows per transaction. Remove unu= sed indexes.

flushing of the WAL to the disk h= as to happen anyway(just that it will be delayed now), so can this method c= ause contention in the database=C2=A0storage side if the speed in which=C2= =A0the data gets ingested from the client is not getting written to the=C2= =A0disk , and if it can someway impact the data consistency for the read qu= eries?

Not quite clear what= you are asking here re data consistency. The data will always be consisten= t, even if synchronous_commit is disabled. The only danger window is on a s= erver crash.

(Keep in mind that RDS is not Postgre= s, so take tuning recommendations and advice with a grain of salt.)



Th= ank you Greg.

Yes, our Java application was doing = row by row commit and we saw that from pg_stat_database from the column &qu= ot;xact_commit" which was closely the same as the sum of tup_inserted,= tup_updated, tup_deleted column. And also we verified in pg_stats_statemen= ts the number against the "calls" column were matching to the &qu= ot;rows" column for the INSERT queries, so it means also we are insert= ing exactly same number of rows as the number of DB calls, so it also sugge= st that we are doing=C2=A0row by row operations/dmls.

<= div>=C2=A0And we then asked the=C2=A0application tema to make the inserts i= n batches, but still seeing those figures in these above two views are not = changing=C2=A0much the number "xact_commit" is staying almost sam= e and also even the "calls" and the "rows" column in pg= _stats_statements also staying almost same. So does it mean that the applic= ation code is somehow still doing the same row by row processing or we are = doing something wrong in the above analysis?=C2=A0

And another thing we noticed , even after the data load finished , even th= en the "xact_commit" was keep increasing along with "tup_fet= ched", so does it mean that its doing some kind of implicit commit eve= n for the fetch type queries which must be "select" queries i bel= ieve? Also not sure if its expected, but here in postgres i have seen unles= s we put a code within begin and end block , it's default gets committe= d even we just run it on the console , it doesn't ask for a explicit=C2= =A0commit/rollback ,so not sure if that is someway playing a role here.

Regards
Veem

= =C2=A0
=C2=A0
--000000000000308ffb062252b455--