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 1rri9N-002Cnu-4e for pgsql-admin@arkaria.postgresql.org; Tue, 02 Apr 2024 17:42:21 +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 1rri9L-00ATO2-TQ for pgsql-admin@arkaria.postgresql.org; Tue, 02 Apr 2024 17:42:19 +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 1rri9L-00ATNt-H6 for pgsql-admin@lists.postgresql.org; Tue, 02 Apr 2024 17:42:19 +0000 Received: from jakobs.com ([85.214.83.89] helo=rs.plausibolo.de) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rri9G-000Gd0-MN for pgsql-admin@lists.postgresql.org; Tue, 02 Apr 2024 17:42:18 +0000 Received: from localhost (localhost [127.0.0.1]) by rs.plausibolo.de (Postfix) with ESMTP id 7050B3807F7; Tue, 2 Apr 2024 19:42:13 +0200 (CEST) Received: from rs.plausibolo.de ([IPv6:::1]) by localhost (h2367442.stratoserver.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id hnabkzgRfW1A; Tue, 2 Apr 2024 19:42:13 +0200 (CEST) Received: from [192.168.178.88] (xdsl-84-44-210-131.nc.de [84.44.210.131]) by rs.plausibolo.de (Postfix) with ESMTPSA id F29C838042C; Tue, 2 Apr 2024 19:42:12 +0200 (CEST) Message-ID: <0ce31eb2-4209-dc00-adf9-4d2c05ec5187@jakobs.com> Date: Tue, 2 Apr 2024 19:42:11 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Content-Language: de-DE To: Rajesh Kumar Cc: Pgsql-admin References: <58661f82-620c-8116-efe7-23266578289c@jakobs.com> From: Holger Jakobs Subject: Re: Deadlock In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------E4ZLbljYRq9AquYzOx5lYMfn" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --------------E4ZLbljYRq9AquYzOx5lYMfn Content-Type: multipart/mixed; boundary="------------mYj1o0syu1D0Dk9T0cFxlYHE"; protected-headers="v1" From: Holger Jakobs To: Rajesh Kumar Cc: Pgsql-admin Message-ID: <0ce31eb2-4209-dc00-adf9-4d2c05ec5187@jakobs.com> Subject: Re: Deadlock References: <58661f82-620c-8116-efe7-23266578289c@jakobs.com> In-Reply-To: --------------mYj1o0syu1D0Dk9T0cFxlYHE Content-Type: multipart/alternative; boundary="------------50E0kuFjIdchDvwtxttuTLXE" --------------50E0kuFjIdchDvwtxttuTLXE Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: base64 DQpBbSAwMi4wNC4yNCB1bSAxOTowOSBzY2hyaWViIFJhamVzaCBLdW1hcjoNCj4gWWVzLCBJ IGFtIHRyeWluZyB0byBmaW5kIG91dCB3aGF0IG1lc3NhZ2UgaSBzaG91bGQgcmVwbHkgaWYg SSByZWNlaXZlIA0KPiBlbWFpbCB3aXRoIGRlYWRsb2NrIG5vdGlmaWNhdGlvbi4NCj4NCj4g SSB1bmRlcnN0YW5kIGhvdyBkZWFkbG9jayBvY2N1cnMsIGhvdCB0byBmaW5kIHRoZW0gaW4g bG9ncywgcHJldmVudGlvbiANCj4gb2YgZGVhZGxvY2soZXg6IG9xdWVyaWVzIGluIG9yZGVy KSBldGMuDQo+DQo+IEJ1dCBzaW5jZSB0aGUgZGVhZGxvY2tfdGltZW91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g0KPiAgICAgSG9sZ2VyIEpha29i cywgQmVyZ2lzY2ggR2xhZGJhY2gsIFRlbC4gKzQ5LTE3OC05NzU5MDEyDQo+DQo+ICAgICBj aGF0IHdpdGggbWUgb24gU2lnbmFsIG1lc3Nlbmdlcg0KPiAgICAgPGh0dHBzOi8vc2lnbmFs Lm1lLyNldS9HcElQMjU5YkJuZV9KaUJZSkZ2YlpDTFlKRUxoQi05Mm5KZm5jQUNMMUxVZUJP cGhmWEZGZ0xZWVZYdl9BR2hnPg0KPg0KSSB3b25kZXIgd2hhdCB5b3UgYXJlIHdyaXRpbmcg YWJvdXQuIEEgZGF0YWJhc2UgZG9lc24ndCBzZW5kIGVtYWlsIA0Kbm90aWZpY2F0aW9ucy4g VGhhdCBtdXN0IGJlIGEgZmVhdHVyZSBvZiBzb21lIGFwcGxpY2F0aW9uLg0KDQpTbyB5b3Ug d2lsbCBoYXZlIHRvIGRlYWwgdGhlIHRoZSBhcHBsaWNhdGlvbiBjb2RlIG9yIGl0cyBkZXZl bG9wZXJzLg0KDQpPciBpcyBpdCBhIGN1c3RvbWVyIHNlbmRpbmcgeW91IGEgbWVzc2FnZSB0 aGF0IHNvbWUgZGVhZGxvY2sgaGFwcGVuZWQgb24gDQp0aGVpciBzeXN0ZW0/IFN0aWxsLCB5 b3UgaGF2ZSB0byBkZWFsIHdpdGggdGhlIGFwcGxpY2F0aW9uIGNvZGUgb3IgdGhlIA0KbG9n IGZpbGVzIG9mIHRoZSBkYXRhYmFzZSBzeXN0ZW0uDQoNClJlZ2FyZHMsDQpIb2xnZXINCg== --------------50E0kuFjIdchDvwtxttuTLXE Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable


Am 02.04.24 um 19:09 schrieb Rajesh Kumar:
Yes, I am trying to find out what message i shoul= d reply if I receive email with deadlock notification.

I understand how deadlock occurs, hot to find them in logs, prevention of deadlock(ex: oqueries in order) etc.

But since the deadlock_timeout is 1s, they don'= t probably hang around. So post getting an alert, not sure what to respond to them

On Tue, 2 Apr 2024, 22:15 Holger Jakobs, <holg= er@jakobs.com> wrote:
Am 02.04.24 um 18:40 schrieb Rajesh Kumar:
Hi

If I receive an alert for deadlock, wha= t should I do? Like what analysis should I do? No way to find a root cause?
Under pg_locks, what I can analyse?=C2=A0=

If you receive an error with a deadlock, the current transaction is dead. You have to decide whether to try again.

Within the error message you find a hint which other (not aborted) transaction was involved in the deadlock. So you have all the information you need to find the culprit.

Regards,

Holger

--

Holger Jakobs, Bergisch Gladbach, Tel. +49-178-9759012 3D=
chat with me on Signal messenger

I wonder what you are writing about. A database doesn't send email notifications. That must be a feature of some application.

So you will have to deal the the application code or its developers.

Or is it a customer sending you a messag= e that some deadlock happened on their system? Still, you have to deal with the application code or the log files of the database system.

Regards,
Holger
--------------50E0kuFjIdchDvwtxttuTLXE-- --------------mYj1o0syu1D0Dk9T0cFxlYHE-- --------------E4ZLbljYRq9AquYzOx5lYMfn Content-Type: application/pgp-signature; name="OpenPGP_signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="OpenPGP_signature" -----BEGIN PGP SIGNATURE----- wmMEABEIACMWIQScuJCxWJK1p5BOebGKV5yTsxlhugUCZgxDcwUDAAAAAAAKCRCKV5yTsxlhujij AJoDp5FNVfcZlyqXjc81X9EJRZGdAgCeLdofJhR82z8Wxhnkpo1xBy+P7Vg= =WT+3 -----END PGP SIGNATURE----- --------------E4ZLbljYRq9AquYzOx5lYMfn--