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 1uZxx2-00BfFe-1H for pgsql-general@arkaria.postgresql.org; Thu, 10 Jul 2025 20:33:04 +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 1uZxx0-00GqCi-4K for pgsql-general@arkaria.postgresql.org; Thu, 10 Jul 2025 20:33:02 +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 1uZxwz-00GqCY-P3 for pgsql-general@lists.postgresql.org; Thu, 10 Jul 2025 20:33:02 +0000 Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uZxwy-006tt9-1F for pgsql-general@lists.postgresql.org; Thu, 10 Jul 2025 20:33:02 +0000 Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-60c9d8a16e5so2695693a12.0 for ; Thu, 10 Jul 2025 13:32:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1752179577; x=1752784377; 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=ZxxPbCBYUlEl79+9NM1KkV8oqQBmX7S+jt+u1DZzXzA=; b=LGgW5MNn0uqjBrMatGkmOMn8svTwdcn+kH2NgTmQESK0ptkOUWSUSyOc1au3JSUqYi ISjdP+Y0UMtOO2mEiWFkJWjjmDo2EJ0jVLUR3HoF7gpTfrA/qs20u/VSWnDmy2aX7NsS fPaLa42jWuHMZh9vntVdV5yFE1wJbWpt47YGg0ql+88+4RDSV+HAfYJRIUfL5n42DPHI rMwX5w3oRrtAFYxyGc0zuePj+W1yhjy7FKdtBaGz8aA5tkV1gHOJLpi9CucMGtxwpllP FBUbuW7Iwor8hoOCz/BgWBlb8fG142Ask8b9GNLxOKWLogM6yz1BGBMVx/oDeSLtCAUF qe3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752179577; x=1752784377; 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=ZxxPbCBYUlEl79+9NM1KkV8oqQBmX7S+jt+u1DZzXzA=; b=CCCmKlBuTfzLP/HuWR8NpzQiMTV36yG8bOIRy7OZtCOKh1ihrc1gOJ6EcmN35VAtq8 LBt+Lc2c+i27us/rjs9tROsjf6GYV5POtc9eDdSqvUPs8SlXBfMH8ndxsUa4r4dAlU19 GJ4NIExlccuiNajqAqDPIA4O1aX404sNdiGocp5bON+2yh5Cs3TYXBx7mHPuTPCvpxlD 3rZJEa5x1ozISNoSjMpDJWdRlLSQzINUKp6TabzL4/K2mgw67oPe/VyifWjm60zQlTGN /e25NPr2SuIfSq9XHLb94lK9onMz4vWNrb5XwV0l0C6kxuad+dfEk+v5qsikiNMjruBO yCdA== X-Gm-Message-State: AOJu0YxanjW/bU576BuG3fChfh8P3JaI89VopD6pi3BJRE4cuLxNckrM uEMwAfm0OY+X3DWOTcFxBOP7aMiWoxxfEf/5jb47nk7/BlTfeIuBJUKnVeJi2Wlk4e2FZREo05T le8Ml1EaAPvomNtdREgAPE2XMF6sxR+CmxQ== X-Gm-Gg: ASbGncsq66h3Lw/sno1iEAG2FPq6M6Gb+fAXV/pXvPhr2DdmUXkVezsokcujwzcJxD/ bo2tkfAESd4E7Qgnva51m6f4N1cSvTKMg8p3Vtr69sb2crhkaUv9y69OJwnjhoMj0lqHNWRoM7Y KVBBgo7tmTIw/FijC7akqCq8ZJPudsTLfOZDMsgSk8OHin X-Google-Smtp-Source: AGHT+IE9IuJeIQCvbzKFddS082S4UW2Lias6o8SjVLPV0kGLDVETHdHqlO4Rh9AkeAOGgAULl/xBoGlCqIgO/Wgb67c= X-Received: by 2002:a50:cd11:0:b0:601:e99c:9b19 with SMTP id 4fb4d7f45d1cf-611e760e57dmr282870a12.1.1752179576926; Thu, 10 Jul 2025 13:32:56 -0700 (PDT) MIME-Version: 1.0 References: <1529239.1752161326@sss.pgh.pa.us> In-Reply-To: <1529239.1752161326@sss.pgh.pa.us> From: Steve Baldwin Date: Fri, 11 Jul 2025 06:32:45 +1000 X-Gm-Features: Ac12FXynoadxE7lNI4ITMbfTwtgnQHXhJEi4LqS2sr4Dl1doESqYjRgFXoEJcrI Message-ID: Subject: Re: Lock timeout in commit To: Tom Lane Cc: "pgsql-generallists.postgresql.org" Content-Type: multipart/alternative; boundary="00000000000043f5750639991957" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --00000000000043f5750639991957 Content-Type: text/plain; charset="UTF-8" On Fri, 11 Jul 2025 at 01:28, Tom Lane wrote: > > I think all you could do is monitor the pg_locks view and hope to > catch the process in "waiting" state before it fails. > > It occurs to me to wonder though if we couldn't provide more > context in the error about what lock is being waited for. > > Thanks Tom !! The application is an API server so we intentionally set the lock timeout to a very short interval (5 ms). Having locking context would be great. Other than deferred FK constraints, what other locking actions are deferred to commit time? Cheers, Steve --00000000000043f5750639991957 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Fri, 11 Jul 2025 at 01:28, Tom Lane &l= t;tgl@sss.pgh.pa.us> wrote:

I think all you could do is monitor the pg_locks view and hope to
catch the process in "waiting" state before it fails.

It occurs to me to wonder though if we couldn't provide more
context in the error about what lock is being waited for.

Thanks Tom !!

The application is an API se= rver so we intentionally set the lock timeout to a very short interval (5 m= s). Having locking context would be great.

Other t= han deferred FK constraints, what other locking actions are deferred to com= mit time?

Cheers,

Steve
--00000000000043f5750639991957--