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.96) (envelope-from ) id 1vOaG8-00Dq86-1H for pgsql-docs@arkaria.postgresql.org; Thu, 27 Nov 2025 11:34:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vOaG5-005q3n-1z for pgsql-docs@arkaria.postgresql.org; Thu, 27 Nov 2025 11:33:57 +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.96) (envelope-from ) id 1vOaG5-005q3f-1G for pgsql-docs@lists.postgresql.org; Thu, 27 Nov 2025 11:33:57 +0000 Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vOaG3-001ji3-1N for pgsql-docs@lists.postgresql.org; Thu, 27 Nov 2025 11:33:56 +0000 Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-b735487129fso112804166b.0 for ; Thu, 27 Nov 2025 03:33:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1764243234; x=1764848034; darn=lists.postgresql.org; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=7F5fKmW2H6EAljB8vKWQDdWJBDHv5thEIph0Xw2KhdY=; b=RrfNEcvOZe+YgTqumlNCnz1fIHKIMXphLZvFM4mkid/tHgmdPtvX0uKMBa2/WUA3Fx eHQHCAsFTZCVJ9qYI9NkB3kZFVItoLG03VFQ6gb0itTFr05V7b6VfGdmbsCqR4fIS7Lc LitlM+uJEDRB4XEanYeeUGXlPDerq7bpE/MMeKCHqhUBR9BVJOXnaKH+BZVsvEvvPLHt Mt1mNhid7MaIGuWSDZ5l2dyq62hGMxjSny/h+BRlZOxLuslklOhRK2+/wwSO+wGdoiXm iY+HtzRgGUz0TmTq8QckZ0v5NDnHIll9WL25H7Yrk0DmlmiCBpwhgitPeEC7A39ro6qA v0HA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764243234; x=1764848034; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=7F5fKmW2H6EAljB8vKWQDdWJBDHv5thEIph0Xw2KhdY=; b=MXZP9+MMsKtX0mnFH+SD+NaLwbvHJFljMUV/oTlFFPIF5jYOkpAIVeoeRRmxreG0Vp /Si5ScT30A9MaEwAwRlirBhxibCTMHwFp5Pkk/M1Jt+GKnUXgFkONrdFHXtfzewJxjC7 b1doxyGDO3SmPxj34A19yqtaYc/LpFwAzp1eLBJAp6DkFozLHGJoebvjXyesb8ziBSiU CQkjCNoTb2XBUB46y0bnin4S7e0QrhF0/kraRkHWYBMcYOjYoYhlu3V2hF6iJij+d0Da aZuX5Hdak2LSqrPnfOvMqeqApGdbkUNPSPxH6T6UNkxWRQIc8sXeyMAQ5ErJRa/IZF+E +6tA== X-Gm-Message-State: AOJu0YyqIl8rQxcyVSFK2U3jY/EMjXr5+LMk/UUZu1KjIaPJbiOlwQxy ilRQ8pHuM80kLm1tQ49ha6hjjC4ujPrb0JVWGYb/+9kLALZref9HaoWo X-Gm-Gg: ASbGncsgpiaPwgH+hlQIiVvGq1SqwmkSbwST9TzK4NmLaPz0yrM3F2tCC2AO9cb/kaV E3zvYPWgGYUgAQGaamefc6eQukudp22ZZZuVU6HJTWa/dLMjktV+G2q9UEjcomkTvjZRtPtvfpX mNSj5uYHReBROhW3UCjupwQjCXU2R6dOnVKq2i7zgyB1FnsKg8J041zPk7UTcwl5wp6Yr5bBu1D nbo1mXyJvcXqq8BPGmLkcv2DKVOEoXT2iKu5lsrO3IVDlSVJHXdAbEvW0dQM2QFZSD6mIbEjYMy h+4QlvZl4ABnTlhfm36l0ORjX6yzf7DN0nEIWCi/Z6fzWZY01RMS4AARfdeSyF4AMpvYb4jrFW+ smYnbanjV8ByDnjcMN22FY+xhV0fXkTTDGz0hszFZ6J7RZ0ivAnB9tVxel4B67xpZK0X4IiQMJx Lk34DecXnubgaXn8RIGhUSwntNnL++dq0A7mvK0EmAboH0g2F42JeohQ5U8zggMrVVanicAH8mm YE3xK5hUblSX2+Lr6Ey X-Google-Smtp-Source: AGHT+IGAayBBaNJffNqPUUISefGJlG5CiNpnAwIEFdJfiE+0EcqIORedn3pVJiA2T1XiPJHDN902Aw== X-Received: by 2002:a17:907:3e89:b0:b73:9792:9199 with SMTP id a640c23a62f3a-b767170c8cfmr2401189666b.37.1764243233560; Thu, 27 Nov 2025 03:33:53 -0800 (PST) Received: from smtpclient.apple (cpe.ge-0-3-7-100.noenqe11.dk.customer.tdc.net. [95.166.159.242]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b76f5162c5csm146036166b.6.2025.11.27.03.33.52 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Nov 2025 03:33:53 -0800 (PST) From: Alpha Shuro Message-Id: <8E0BD202-AB51-4FE7-972A-D83838A29D8C@gmail.com> Content-Type: multipart/mixed; boundary="Apple-Mail=_BE986CF0-2EBD-44FF-BA27-47E5C0471682" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.700.81\)) Subject: Re: (docs): add missing info about ShareLocks Date: Thu, 27 Nov 2025 12:33:42 +0100 In-Reply-To: <58e8295701c9e15c251ed608c5ed297688c785a2.camel@cybertec.at> Cc: pgsql-docs@lists.postgresql.org To: Laurenz Albe References: <4274DCF3-177F-43D8-8547-90B8540B6619@gmail.com> <58e8295701c9e15c251ed608c5ed297688c785a2.camel@cybertec.at> X-Mailer: Apple Mail (2.3826.700.81) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --Apple-Mail=_BE986CF0-2EBD-44FF-BA27-47E5C0471682 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Ah thanks for pointing this out, I've moved it to the xact-locking page = instead --Apple-Mail=_BE986CF0-2EBD-44FF-BA27-47E5C0471682 Content-Disposition: attachment; filename=document-ShareLock-when-using-deferred-unique.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="document-ShareLock-when-using-deferred-unique.patch" Content-Transfer-Encoding: 7bit diff --git a/doc/src/sgml/xact.sgml b/doc/src/sgml/xact.sgml index 3aa7ee1383e..d753869cc88 100644 --- a/doc/src/sgml/xact.sgml +++ b/doc/src/sgml/xact.sgml @@ -102,6 +102,13 @@ of multixact IDs (mxid; see ). + + + If there is a DEFERRED UNIQUE constraint on a row inserted in a transaction, + and there are multiple concurrent transactions inserting the same unique key, + the earlier transactions will wait for later transactions by + acquiring a ShareLock on the transaction ID. + --Apple-Mail=_BE986CF0-2EBD-44FF-BA27-47E5C0471682 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii > Den 22. nov. 2025 kl. 13.07 skrev Laurenz Albe = : >=20 > On Sat, 2025-11-22 at 09:07 +0100, Alpha Shuro wrote: >> I had a production incident a few weeks ago while using deferred = indexes, where >> the Postgres docs lead me down the wrong path of investigation due to = missing details. >> Specifically, the docs implied that a `ShareLock` was only acquired = when creating >> indexes, but only after looking at the code did I learn that this = lock is also >> acquired when transactions are waiting for other transactions to = complete. >> I think this would be helpful to someone who might find themselves on = the same path >> in the future, and as I understand it this mailing list is the way to = submit patches >> to the docs? >=20 > No, that is wrong. This section is about table locks, and a lock on a = transaction ID > should, if anywhere, be documented elsewhere. Actually, there is = already something > about transaction ID locks in = https://www.postgresql.org/docs/current/xact-locking.html >=20 > Perhaps you could improve that short documentation? >=20 > Yours, > Laurenz Albe >=20 > PS: There are also SHARE locks on rows. --Apple-Mail=_BE986CF0-2EBD-44FF-BA27-47E5C0471682--