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 1sqY1m-00AenQ-O9 for pgsql-general@arkaria.postgresql.org; Tue, 17 Sep 2024 13:13:59 +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 1sqY1m-00Ajvb-0e for pgsql-general@arkaria.postgresql.org; Tue, 17 Sep 2024 13:13:58 +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 1sqY1l-00AjvS-KQ for pgsql-general@lists.postgresql.org; Tue, 17 Sep 2024 13:13:57 +0000 Received: from mail-lj1-x229.google.com ([2a00:1450:4864:20::229]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sqY1e-001dyF-K8 for pgsql-general@lists.postgresql.org; Tue, 17 Sep 2024 13:13:56 +0000 Received: by mail-lj1-x229.google.com with SMTP id 38308e7fff4ca-2f7502f09fdso42237451fa.1 for ; Tue, 17 Sep 2024 06:13:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726578829; x=1727183629; 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=gLRN8uWVfVVftZStcmM4uhhqUD9fzyp99Ejacz181pI=; b=XGbR0HJePXyxstLn9FTFOCRdEkUErbvGSfc1IUIRcsLL901IBz3mSZUGZvNYOwDQHL gwj69EIxG0Dvrxb2ksGlVvusj4wYXKOxVf744YjOlA73SaLvnwFmIH/c90wObAsrt8vf sVh3MIha1/rOfsnrZ8q6z9EUu2dgoDsHHhxLTYRtXI0CK05VmhOhJ9/MPkIf8Hz9QfE+ vWNW6bxy6KVihoRZCl23yImd6q5hO9b6s0zgwh9jiH14INElSQ+xU5olWQQu0t11poV+ OMl6S2iKOQUCCBjBOC/aYD7OTJJexnykfrYUtdtpOBjvungA9JMg6g1l3D40pj0gXDIK X2hQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726578829; x=1727183629; 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=gLRN8uWVfVVftZStcmM4uhhqUD9fzyp99Ejacz181pI=; b=blYj0JUzgc3VhhNXtZNJw1TYInXbj89gVNPS9z7JqKtcQKwJJygS4o8upXlNLYgJsl fjbz4rUaehQZAygbvnHKL0RZxz0LRQzugao5MUkzS2KVxAFscEv5fm0ab4WH9i9U73/r vFQ19UKQ5xQtdM1cS9/NidWHlEuSUfhedEsO9Rv7QBQep6OTDHrX6rOcUnOEf02ME6qh KQiRVXcSW9DnI3OqNE+Zu+Ll0eZNQwncR5tcg9rCZUuCg6UVV4r3xFTLOn8f7TQfSldr 8qlEjlNme5ySOQpfQvf+aXV75UR6sMnT+Gkiiu2qSPAb7mdNxbdYiFK7hxH02hVZW/kb i6vA== X-Forwarded-Encrypted: i=1; AJvYcCW0/l7dcvWYFYtJEzEGzkmKvSq/y4QER38O7c1frim9O4wLIMGIohvWbCO7xofRd0IKKEuNAiYP2LStOsCg@lists.postgresql.org X-Gm-Message-State: AOJu0YzpcUdZmQiN4gF8JFSTlc1+uuqQG6MAWDLwrx5nGdGHbqQbJSuF JCYh2r1ngLHrnXbeu9xV0bozoHAwAhP+spAe0lGDyV+M2ZYB8Baa5z66hbIpF4J1adJHChYtezv 22zW/RylLDOP6uKM8Cgn2k/A8zA0= X-Google-Smtp-Source: AGHT+IG+X3C3FXRBFmt3juLersZWLaRD9925eut6qcY+xCeWC0AWvMCYFb/FHU0XSpxuUKaBajMbbhBxmKnnP+o6rHo= X-Received: by 2002:a05:651c:1a0b:b0:2f7:6371:6c5a with SMTP id 38308e7fff4ca-2f787d061fbmr59824291fa.16.1726578828793; Tue, 17 Sep 2024 06:13:48 -0700 (PDT) MIME-Version: 1.0 References: <3dddea5e-52ab-4075-970d-a87b0c921ae7@aklaver.com> In-Reply-To: From: Greg Sabino Mullane Date: Tue, 17 Sep 2024 09:13:12 -0400 Message-ID: Subject: Re: IO related waits To: veem v Cc: Adrian Klaver , Christophe Pettus , pgsql-general Content-Type: multipart/alternative; boundary="000000000000c4642706225075da" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000c4642706225075da Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Sep 16, 2024 at 11:56=E2=80=AFPM veem v wrote= : > So what can be the caveats in this approach, considering transactions > meant to be ACID compliant as financial transactions. > Financial transactions need to be handled with care. Only you know your business requirements, but as Christophe pointed out, disabling synchronous commit means your application may think a particular transaction has completed when it has not. Usually that's a big red flag for financial applications. we are using row by row transaction processing for inserting data into the > postgres database and commit is performed for each row. 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.) Cheers, Greg --000000000000c4642706225075da Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Mon, Sep 16, 2024 at 11:56=E2=80=AFPM = veem v <veema0000@gmail.com&g= t; wrote:
So what can be the c= aveats in this approach, considering transactions meant to be ACID complian= t as financial transactions.

Fi= nancial transactions need to be handled with care. Only you know your busin= ess requirements, but as Christophe pointed out, disabling synchronous=C2= =A0commit means your application may think a particular transaction has com= pleted when it has not. Usually that's a big red flag for financial app= lications.

we are using row by row transaction processing for inserting data int= o the postgres database and commit is performed for each row.
<= div>
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 n= ow), so can this method cause contention in the database=C2=A0storage side = if the speed in which=C2=A0the data gets ingested from the client is not ge= tting written to the=C2=A0disk , and if it can someway impact the data cons= istency for the read queries?

Not quite clear what you are asking here re data consistency. The data w= ill 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.)

Cheers,
Greg
= =C2=A0
--000000000000c4642706225075da--