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 1ubh0c-0042Xs-Ex for pgsql-general@arkaria.postgresql.org; Tue, 15 Jul 2025 14:51:54 +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 1ubh0a-002dSe-GM for pgsql-general@arkaria.postgresql.org; Tue, 15 Jul 2025 14:51:53 +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.94.2) (envelope-from ) id 1ubh0a-002dSU-60 for pgsql-general@lists.postgresql.org; Tue, 15 Jul 2025 14:51:52 +0000 Received: from mail-io1-xd29.google.com ([2607:f8b0:4864:20::d29]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1ubh0Y-007QAA-21 for pgsql-general@lists.postgresql.org; Tue, 15 Jul 2025 14:51:51 +0000 Received: by mail-io1-xd29.google.com with SMTP id ca18e2360f4ac-86d029e2bdeso228618939f.1 for ; Tue, 15 Jul 2025 07:51:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1752591110; x=1753195910; 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=QV6mDv8+AsqvC409DAOJUOuftBmipwqrUyNd5Q5dnD8=; b=g/QahOSirtg0/qmEBgldOSHdomPXE+7Ep3uDBX+yVnYPcRnjwgQZelzuMDSM7H66Li kcD42A/8SeM25yM72Dujt/H9xayjm28pVQdxODBE6+tNCLglFUuEDOiPzYa9BQj1jHrO ePcx0g4bBpY0vUocd5ks2Ha6aQ8+1xcwSdaxmH7liZm+rnETR8rWVzGYnpAyQunD3xWt 0ov76RSXebtztjNUuFBQoa8MQoj+yHxbgmLq8+kddruzlGUft9MOvWJ9yXz71nGBSPpO CqKifFXYiZaURAPHomBHWpsvPjv6Yb3ZyEgw8Lvm60t7cgy7V0wyk81CEw7Y72f1EbnT wIjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752591110; x=1753195910; 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=QV6mDv8+AsqvC409DAOJUOuftBmipwqrUyNd5Q5dnD8=; b=q+HXeaupn6QXPqj21vWszQVoutZ54CHQtJPMXy3a3BOJLRkO5IN7pNDOIx976/vY9Q 9b5YXFhIS560oZnRSLJhHzdpSpyCW222ToSxODyfDoq2z5s1f3XHUdpIoA9qBAzzYB0i ABvJEAArejJBHP0dht66t1hy5x+BaJYGOWntfFWvvlNdZIS7AC7Cx+hGeRELiPg3r620 /8hIYuaRGdXdqO4DaggjhI4wN4D9FYwSPXs9zdbM1ye6Am8PcN4GMK3O7YQBwhais/OM ODmLTtx7v8qZIFvHg6aH2PqDT4I15pU+e19OUsAcdMHkoB8SQRgSD0w9FBI9zUXBVLb0 7HiA== X-Forwarded-Encrypted: i=1; AJvYcCXsu65lLsJRUpLKAeaqHousc3I8rDRhELg62LHNmNM48zTPreCziLeX1GWlq/vN4do1s+FDLbmJ39mpG/rQ@lists.postgresql.org X-Gm-Message-State: AOJu0Yy2Z0nLBXU/2pqt0NoRCMz1CwupZOPpD6nreKRiC1TOXqtsom5I aiHWH9K+YsU8Ot1GJ3MTjfW92e812NxUyNx3R0ov52VuCd4T+HdDRe4U+NPYWmXfAKlJZScDA1B ZuPRZU0MwWYGc9AF+2S+dfKE7meqkmFxEcQ== X-Gm-Gg: ASbGncvbxx9dAltmNt9uBZx3zW5/ewVv4MGHPnuxoduACPkUjV6fGF9nGRyxz1iPTyE tWp9uNu4Wzabi496j7JRVahCIWAIT9jWxeZ+AKaUzfBwy1jVD/geBodPtJqJj3tmLiVRIwP9s0/ d4k7xl6oJmDBHTFbK+zOZMyVnzHA1BCWIk5oBqN2DWE4Yz/CuPCbys1kxHik2zwyhFdXnw0kenW EQog0Jeo5vpmfwpfdCL5JakOrxfR3i2GYSBSAd9 X-Google-Smtp-Source: AGHT+IGCEVpFkG9iHjDeVtaT7eEOmWgRUA5EFZt+QW7UhVC9quOqQSYgovViCIju/J6iGNfFYasNuxVh/npeLsq43Zg= X-Received: by 2002:a05:6602:3411:b0:876:b17c:dec3 with SMTP id ca18e2360f4ac-879af05ab13mr497958139f.8.1752591109690; Tue, 15 Jul 2025 07:51:49 -0700 (PDT) MIME-Version: 1.0 References: <826536fd65cb6b25e996ac449336ce9c2476174b.camel@cybertec.at> <903134.1752590744@sss.pgh.pa.us> In-Reply-To: <903134.1752590744@sss.pgh.pa.us> From: Greg Sabino Mullane Date: Tue, 15 Jul 2025 10:51:14 -0400 X-Gm-Features: Ac12FXw79QV0m5Tw0IZnFT1_3aVuwk6BSHapi37aTPp4-kAnYtfziZtajmIe9jo Message-ID: Subject: Re: Regarding query optimisation (select for update) To: Tom Lane Cc: Laurenz Albe , Durgamahesh Manne , pgsql-general Content-Type: multipart/alternative; boundary="000000000000879a120639f8ea70" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000879a120639f8ea70 Content-Type: text/plain; charset="UTF-8" You might want to examine the SKIP LOCKED feature as well, if you are using this query to have multiple workers grab chunks of the table to work on concurrently. Cheers, Greg -- Crunchy Data - https://www.crunchydata.com Enterprise Postgres Software Products & Tech Support --000000000000879a120639f8ea70 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
You might want to examine the SKIP LOCKED= feature as well, if you are using this query to have multiple workers grab= chunks of the table to work on concurrently.

Cheers,
= Greg

--
Crunchy Data - https://www.crunchydata.com
Enterprise Postgres Software Products & Tech Support
=
--000000000000879a120639f8ea70--