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 1tboOA-00DZHR-B6 for pgsql-performance@arkaria.postgresql.org; Sat, 25 Jan 2025 22:12:26 +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 1tboO9-0052sQ-Co for pgsql-performance@arkaria.postgresql.org; Sat, 25 Jan 2025 22:12:25 +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 1tboO9-0052sI-38 for pgsql-performance@lists.postgresql.org; Sat, 25 Jan 2025 22:12:25 +0000 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tboO6-001VXP-1b for pgsql-performance@lists.postgresql.org; Sat, 25 Jan 2025 22:12:24 +0000 Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-21619108a6bso55063565ad.3 for ; Sat, 25 Jan 2025 14:12:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737843140; x=1738447940; darn=lists.postgresql.org; h=to:in-reply-to:cc:references:message-id:date:subject:mime-version :from:content-transfer-encoding:from:to:cc:subject:date:message-id :reply-to; bh=QbLXUz9g2SgMvDEe7X3C+2SicP5gNUEnOA3URmFKulc=; b=K5L8bf7Dtk6766sEWRXJYfiwXBQVorotyWU/aMQwhWPnRHQ/WR8swNVSV72eeJOId/ uxHXNfwdbEQAbO8ED8+vd74I5Lo/ha+iVwYVQqCJqSzEYdopTzVfgTbgpTJFyiymrMsZ dx7KwgXcw8sOAEn2NIoUiQzvCdjOt7aHqlA6uZKaWDCfDqOrjTF2PTcCUcrijIxbcnYu KQwxoAjxEyJZJi7OYmwlG/4fZ10wMlPKfG+481DdQni11CsSDn6mOhNQjj0J0vqyr5Z/ fjF9Gt+h/kZhNfI/M/NleCJcJ7IZmhSPvLBmlAKTPcZNL7q4249TzmVIF4MS4yDjDZ+1 NKkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737843140; x=1738447940; h=to:in-reply-to:cc:references:message-id:date:subject:mime-version :from:content-transfer-encoding:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QbLXUz9g2SgMvDEe7X3C+2SicP5gNUEnOA3URmFKulc=; b=IpANGy/k0Ddbws2q9M3c3H0e/g6w39K8VUm+pqZiYn0//8Sd2i+U2Fv0T77Ra3cpIQ 5RxhT4b1lrbNzY0eWlj759m2rYAhx1xmkJHMkUjSZj/3kcXTaskiKghx9CCZ9v/kyEWo 0+HtlyZyTaBUwoPfIq7piDU98VBMxEXHB2tWZiKtzz9mXrcdeF6F9do85wdlOO+5XWpk 2KxHVq3Jtbgz4FO9gkCQRBLvXrPVXpz4CQFK//mEwyq4NsNUTjVFqtvHzxOUc7QY9/VY 8x/xHhC1YlUS1CvOIQAg3Zf2DfmXlUoPY1++puZRzrVmP58Rs5TYYMCeN/z4aurYRlvN RkWQ== X-Forwarded-Encrypted: i=1; AJvYcCW4+Y+dJ61uKfMoOVLBI0wcq4E0PfW+f+lT8KeBJf6uDOpHN1wFuniosejL2p96xbPIp+d4bXB9XriNtCK4BDUegg==@lists.postgresql.org X-Gm-Message-State: AOJu0Yy73h9qJtFjwNRArqyCWKmH21xsggpAAocp7GkEqBqV2Jk+0mF1 Okqd+lM8YTY7zFjuJexuKow/Zair9SaeBvAAmFmuMctHb2P1C1aLBmTbxw== X-Gm-Gg: ASbGncsdw4JJRQ8JJEHv/pLGszrySU2qRU/jEQOrZIeNAalODhWR71Oh/sg84JadprT SVMQ8fyFDJiZG03tTP5eWZwrSZTReueDN4Bqc8igv92Ox+ncxj2G0Hl5/6gpz/qLUZULB0qZBrz Vc/ShRgyWUF7WLospvME2ZcGD/wJO74go2AoGEMjmTfIfK+3/J/uZQjq5XsQzp/B45eNWvmpDsJ xTfACYWxxq8UJW3KDyr7hEDBGAcOHzbxdq3E1wZp/niGQvlsqNCiVlRY5pb1KESecAcD3TBsrN2 DfswTgUcvbjcaJxTqIIt5qQUjzjgcYKd8+oQOEtAfoJPCIhZVPNow6jtiTTUnWjHoCQZ X-Google-Smtp-Source: AGHT+IEqEqIoL2GqNxFQLxBzEJDgNtjs4RFQ1oF4q4t76KPtQqaDFHDJ9R3MLRKn3EkFstYmhZdU+w== X-Received: by 2002:a17:903:2381:b0:21a:8dec:e596 with SMTP id d9443c01a7336-21c355b54e7mr594996065ad.35.1737843139925; Sat, 25 Jan 2025 14:12:19 -0800 (PST) Received: from smtpclient.apple (172-15-11-90.lightspeed.snjsca.sbcglobal.net. [172.15.11.90]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21da4141baesm36544175ad.144.2025.01.25.14.12.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 25 Jan 2025 14:12:19 -0800 (PST) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: peter plachta Mime-Version: 1.0 (1.0) Subject: Re: Read-only connectios optimizatios Date: Sat, 25 Jan 2025 14:12:18 -0800 Message-Id: <1321473A-8A9F-4EA0-AC11-1312012623CC@gmail.com> References: Cc: Edson Richter , pgsql-performance@lists.postgresql.org In-Reply-To: To: Laurenz Albe X-Mailer: iPhone Mail (21F90) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk You can still block vacuum from running if you have long running (or very ag= gressive) read transactions. I don=E2=80=99t think they are very helpful or p= erformant from a Postgres engine perspective. They can be helpful in application development because they will fail if dev= s attempt any mutations inside read only (from what I recall). Sent from my iPhone > On Jan 25, 2025, at 10:01=E2=80=AFAM, Laurenz Albe wrote: >=20 > =EF=BB=BFOn Sat, 2025-01-25 at 14:55 +0000, Edson Richter wrote: >> -Connections are established using the jdbc "readonly" attribute. >>=20 >> Does PostgreSQL perform any optimization on queries in this scenario to a= void >> establishing locks? Or are these queries treated like any other? >=20 > The only difference that I am aware of is that read-only transactions at t= he > SERIALIZABLE isolation level can release predicate locks earlier, which ca= n > benefit performance. >=20 > But I don't think that you need to worry: reading transactions only take a= n > ACCESS SHARE lock on tables, which won't conflict with data modifications.= >=20 > Yours, > Laurenz Albe >=20 >=20