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 1wIXAs-008BKA-0F for pgsql-general@arkaria.postgresql.org; Thu, 30 Apr 2026 19:35:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wIXAr-008czq-0M for pgsql-general@arkaria.postgresql.org; Thu, 30 Apr 2026 19:35:49 +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.96) (envelope-from ) id 1wIXAq-008czi-2P for pgsql-general@lists.postgresql.org; Thu, 30 Apr 2026 19:35:48 +0000 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wIXAo-000000045RV-1XpD for pgsql-general@lists.postgresql.org; Thu, 30 Apr 2026 19:35:48 +0000 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-4891c00e7aeso11652945e9.2 for ; Thu, 30 Apr 2026 12:35:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1777577745; x=1778182545; darn=lists.postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=TThuQ/oCC8EqQTzWAXtm0b99vgW4IWTEr3nAzlKNnpM=; b=li7vy+wd8RI8UJI/+p0fbJYoi9RKTUobb8DSFpO/9jhAO35kEHwv7wKN+OxscNZ8Pi hAqvKc3/8n4pz20b8QqLJ8bxyT9e0z04+vpOO3zEdj6QK1doqq5GlCS5M5ct+qvOyUm3 P03sp1iz3sV1kwUrkF6U7ZuUQwxvtSXBzTJXOdKMMLBoUQJygNKV2WaE+/3vBSed/HZy 1R5pT3cQ0pAybmyc3eYRP77UcrsV119z0wX6chJcvChqEeuIgmuw5FwFfcNX+rcZl2/C /sUWIYfnWUeDr065M9GWnk7iVCZCWYcLUzLbZEClV3CPJTN03jkCU29GjB2a+DQYA2LU PC5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777577745; x=1778182545; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=TThuQ/oCC8EqQTzWAXtm0b99vgW4IWTEr3nAzlKNnpM=; b=BOKpAyt9U6B9FNJemfu/0KTkvZjJ0KN/R7mc3SAQIn4VPzsMdtNnsYOd3RV3vbX3uD VhVI4rTwIVqSQbo7fYejRh/LBoYS47m4fQQU7lVur8KxlVApEMxRTUTx0A5tNETOHogy u33lzw3803IGOtpc15QmRzbqd5YTJDhYn0cCor0ml0+m4ACFrHlRIoYis2gOrlSKHw/h xNSqE5m0WrmFGirZHzh5BssSmfgx1gAS4AiAbSGsAMgjCEevoMx2ssf7EBhFaYyygGYa zYmtg/awfEFb3Kz1zFzmrnSJ2niqPmGhUqRGl77YzaOFXcKh5sJKlCWQ4Fluvw8CLtFg jl8A== X-Forwarded-Encrypted: i=1; AFNElJ/Ksc1xCLxEJ2+TR0tEykrGfvElXpSN0fGr3e/qyr0euRjYb41ykCODR4Q5TWy7akHWdtThOBkk/IxMySke@lists.postgresql.org X-Gm-Message-State: AOJu0YzFDLCCOrtZw2jZhE927WnL5sCBD+QXbEedU5zjCSvIBeFGwMQw MJYqIlYw8ieHusqOG6F5K8aDQf0p2vgWyNwNFEWe3b+lluDGXiIrJ5FAZEhfzw2YdNE= X-Gm-Gg: AeBDietTajZ05irYIKzrdvrXkkw1g5ZI3Z1rDwkYzv+xP971OZAnRQQRuMhxRGgstZJ oVl8GM8yEj9Xq8mPVHfOGX4ZtaA8wUASQuKkMnqsmQ7RdplbMRuURl9tOgDqxMxo5dXUjqX75WO lq8AkEtpvamoIqbtz8vYKSZE7vfdWuN3+eUUXaEr4ukz6NykJdbcl1t7azLwnbe8Bs3Otzx8MWQ CZEauXJN4B/0BWv63T9uOkYThQG1hzYEAe/XevBc95jaLP3R3oH+TAxZi79BtIg9Rb/KAwNdK2c oybizQJr7yCCI6HbPLSb9QuxfGfZmiiWioHtyIp1gVF02CD7rXI5/+LafakLWJeHAvVoTUA5FxL 6iQ3s6X2ldH4riDcSfFQmKp2fsaSeMR/LcYBwTepd8yR7HI5Bi3LxjE24369pkQQlcvWHhLA5tQ XAUe4pGkdfV+79ybBGatR55ABsrtSfTWNInSjHU1W/hUfwRSZAOK1H3/bR3Bw+g19+Lw== X-Received: by 2002:a05:600c:8599:b0:485:3abe:ab86 with SMTP id 5b1f17b1804b1-48a83d6e262mr50578095e9.4.1777577744559; Thu, 30 Apr 2026 12:35:44 -0700 (PDT) Received: from laurenz.albe-K4N0CV00F97414D ([2001:871:270:4fd5:603f:45c2:9807:c104]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48a8eb5bec6sm661645e9.21.2026.04.30.12.35.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2026 12:35:44 -0700 (PDT) Message-ID: <83819e975523be4d320141ff1363dfb40c82289b.camel@cybertec.at> Subject: Re: Confirmation on concurrent SELECT FOR UPDATE with ON CONFLICT DO NOTHING From: Laurenz Albe To: Matt Magoffin Cc: Adrian Klaver , pgsql-general@lists.postgresql.org Date: Thu, 30 Apr 2026 21:35:43 +0200 In-Reply-To: <93ADF4E5-CF49-4347-8A79-33655A8E0299@msqr.us> References: <087DA595-FB65-49F4-89E9-AE9F5CBF6E4C@msqr.us> <8BCF50C4-D36B-4453-9B09-AA717AE6F563@msqr.us> <93ADF4E5-CF49-4347-8A79-33655A8E0299@msqr.us> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.58.3 (3.58.3-1.fc43) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, 2026-05-01 at 07:07 +1200, Matt Magoffin wrote: > > On 30 Apr 2026, at 6:42=E2=80=AFPM, Laurenz Albe wrote: > >=20 > > So I'd say that the documentation is not quite accurate. =C2=A0Really, = the DELETE does not place > > a row lock on the row. > >=20 > > That must account for the behavior difference: after the SELECT ... FOR= UPDATE, the > > INSERT ... ON CONFLICT interprets the row lock as a conflict and moves = on, while in the > > DELETE case it sees no conflict (yet), but has to wait for the transact= ion to complete before > > it knows how to proceed. > >=20 > > I cannot say if that is intentional; as I said initially, I am surprise= d too. >=20 > Thank you for your additional insights, Laurenz. Also, the behavior difference only occurs with ON CONFLICT DO NOTHING. If you use ON CONFLICT ... DO UPDATE ..., the update will block. That makes the behavior difference somewhat less bad in my eyes. Yours, Laurenz Albe