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 1uCerv-000TTB-GB for pgsql-admin@arkaria.postgresql.org; Wed, 07 May 2025 13:31:27 +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 1uCeru-00EFix-IO for pgsql-admin@arkaria.postgresql.org; Wed, 07 May 2025 13:31:26 +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 1uCeru-00EFip-6V for pgsql-admin@lists.postgresql.org; Wed, 07 May 2025 13:31:26 +0000 Received: from mail-oo1-xc2c.google.com ([2607:f8b0:4864:20::c2c]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uCerr-000dVw-1y for pgsql-admin@lists.postgresql.org; Wed, 07 May 2025 13:31:25 +0000 Received: by mail-oo1-xc2c.google.com with SMTP id 006d021491bc7-60634f82d1aso1893642eaf.3 for ; Wed, 07 May 2025 06:31:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1746624682; x=1747229482; darn=lists.postgresql.org; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=QQkizUeJxz6PV3n5O5ptEIr+M5qVRWxD6SUbPY1QzAk=; b=BZtdISsFO00Ajz5oqsZkSQNKa/hPd7wZDLL2Km/FFYdL+9S4F+7OsM0/ncitQWAtVz PhdiCzWt9mCtCasuKgYQjN4zZkAJHLCteWpbcJLI2WOx+/w8oDqEGowTpt9RHhbP2AZm JRm1zggWDTKzP1Tc/WcwRAyDNHG/YC1KiToWvSIWORFVGSOiB7BssZHN/Vbu+KWqKKTb +sNPp9U7vlyvb6qp5GCW6OqTlvrZCYCvLqUHd6nmTpSNS0uYV8O+JagQce/R4uLVAxE7 cQ3ozBTuWI0KoC91NMZxIDOh4YK2Beq7EVErmxvN5vrz287/nfYjZPouSn8Vcl+1nUlE D2Zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746624682; x=1747229482; h=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=QQkizUeJxz6PV3n5O5ptEIr+M5qVRWxD6SUbPY1QzAk=; b=pfVhkEbmdpt1/36IxB8jdZwYnRNt7kFuuICCxNRI5q8COGySM5UdBk9I24HdTI42sQ 2NKGAOtjDmWW0HulmzSrxGEPZz3UeNjVTbhJQ8m7/r2oh0jnrquBbzCDw1Z0lKC6ajyr iq6XZNAPpGj9pw1DhE8S1PEJfU+1YoPLweL7bNtXtChZNylX6/S7A3L+TjsOrdqH6ihb wD6zDqqX4sCFSYvTO13twHqqma1qTrlrbNIuSZq+oW26feyqu8ASpHp0k6iTDJhH3sTK IZMRt1DazA5gR0oXnCr5uEkFfXhqVVsJhbXRi76H815381SPWSKqQtVeIlpeMzPdEyXu 6gEw== X-Gm-Message-State: AOJu0YwqJoNAoThBhgVji9RU/EBVnidVg+kOVrPLSIPU1X2npE7Os9O9 qDIggMYtERbi47DlUxpDMeBGVYq1NevRYrCh+fXbVgZFmIsPJ8B5LMWgVETiu+X9VTUxk7Tq3AT Q9QLaEO8MFO7f8xrEeY5/QvfpC/aiRA== X-Gm-Gg: ASbGncsNVnXiEZo40RiLtVmVv99aW9ccGIVEIuzTJniz/KO61PMOEZcWqsexNvS1/Z6 Ors4snQrZQgd5xMhKdKfnbIIYRYuKTxxT1kg1tIIaTbqWYwEGI9vf7pFkAYZNi2V9B6OmdMy34x vRrOZvO6rrDBSKgfDs1PN3PsU= X-Google-Smtp-Source: AGHT+IEpGDVdPjXm9kqo5Mz0GyLCvK/EOO1wW1gb6+T2dC503r1UMBMti1oWgNtqMeRnzQaozh2To1YS0CKfCK5G+dA= X-Received: by 2002:a05:6820:1809:b0:601:d595:3b1f with SMTP id 006d021491bc7-60828d379c2mr2216355eaf.6.1746624681639; Wed, 07 May 2025 06:31:21 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Ron Johnson Date: Wed, 7 May 2025 09:31:10 -0400 X-Gm-Features: ATxdqUFj2_zpBNcxPgDt4ibi5VWB6z6AiTXG1UFuuQPty6OmEB2vV_q01XT-JQY Message-ID: Subject: Re: Update command causing lock in DB. To: Pgsql-admin Content-Type: multipart/alternative; boundary="000000000000b486a806348bbf5e" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000b486a806348bbf5e Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, May 7, 2025 at 7:16=E2=80=AFAM Gambhir Singh wrote: > Hi, > > Application team was executing UPDATE statement in DB through Abinitio > graph. When they trigger a job, a session is spawned in DB, in parallel > another session is also spawned and executed the same UPDATE statement. > > When I checked the locks in DB, I found that both the sessions are > updating the same record. My concern is how UPDATE causes locking in DB. > > Here is how MVCC works. If one session is updating a record, it should > release the lock once it updated the row and other one should be able to > acquire the row lock. Maybe I am wrong, please suggest how to handle this > situation. > Do the applications use implicit autocommit, or do they use explicit transaction blocks? --=20 Death to , and butter sauce. Don't boil me, I'm still alive. lobster! --000000000000b486a806348bbf5e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Wed, May 7, 2025 at 7:16=E2=80=AFAM Ga= mbhir Singh <gambhir.singh0= 5@gmail.com> wrote:
Hi,

Application team was executing UPDATE statement in DB through A= binitio graph. When they trigger a job, a session is spawned in DB, in para= llel another session is also spawned and executed the same UPDATE statement= .

When I checked the locks in DB, I found that both the ses= sions are updating the same record. My concern is how UPDATE causes locking= in DB.

Here is how MVCC works. If one session is updating a record,= it should release the lock once it updated the row and other one should be= able to acquire the row lock. Maybe I am wrong, please suggest how to hand= le this situation.
=C2=A0
Do the applications use implicit autocommit, or do they use explicit tran= saction blocks?

--
Death to <Redacted>, and butter sauce.
Don't boil me, I&= #39;m still alive.
<Redacted> lobster!
=
--000000000000b486a806348bbf5e--