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 1tbkTU-00D550-9E for pgsql-performance@arkaria.postgresql.org; Sat, 25 Jan 2025 18:01:40 +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 1tbkTS-0041f9-Ue for pgsql-performance@arkaria.postgresql.org; Sat, 25 Jan 2025 18:01:38 +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 1tbkTS-0041ey-JT for pgsql-performance@lists.postgresql.org; Sat, 25 Jan 2025 18:01:38 +0000 Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tbkTP-001Tsm-1u for pgsql-performance@lists.postgresql.org; Sat, 25 Jan 2025 18:01:37 +0000 Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-5d96944401dso5273870a12.0 for ; Sat, 25 Jan 2025 10:01:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1737828092; x=1738432892; darn=lists.postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:from:to:cc:subject:date :message-id:reply-to; bh=CE6Q7fBHnVL5+ofGpmXCJjIxmJVojkNWggOiI54b8b4=; b=PNkv+ubDXFCP/mlC7sBkICiWQAh4mzWRTSD5Xpw+bIJ97kVzw7eaY7zXepdMHFHwWm vtiacLVYPoOrR8UdyCoZOz1B1785NpaN7pk018CZQZiUOQoo4njsUWVa14Bnqg37cSfm o8LgCrnjuoWLPdbZ7i69bOgOUEuu3HXnlkbmPhBIvXC+7PMgmonAadeHPzbNQ9z9SZva Il8nWqIJUt54CU5UL81BTzS6FpZgGGocjqfTrbQTJ6BZdapK1ocmTi8U2TmBzqGL7w55 l3Wa59rgnpRNEhXk3Fs807ElhRWEiwNruVpRkYuQ6as+N73dpuLVocsRV8Mt5yn9dv9b IoUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737828092; x=1738432892; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=CE6Q7fBHnVL5+ofGpmXCJjIxmJVojkNWggOiI54b8b4=; b=NZxYZrAI7uLm/lWKxGr/cLiusbqOfg3z4MlcIdcx2fqUAL1pTqVueJbzjG1f0SsfU6 eMoLOBmsdG7MTWj0M/62OiZt+lxZrdI5P6DmyOLF7TyjBHzlmlAmjiXepFpc3p5Ltr/7 MC8/KuJrPfBDXvFi3hskFytp8WECoi0eLJGZZUtNlAYddvi16xxirY+VNYYJpjctplWy tGrPB8bonHmYZMLfeWYOQVjwDKrhWgmY2L8UCtBCU9sYXMpHLLK32KINJKdnqBXdYTAy i2yuMEcGxFsphP+wn49OrAe71gaoxLTjj17LVEIx0tuRVkTRBsy/WitCTfBLqnSc7eef euew== X-Forwarded-Encrypted: i=1; AJvYcCU0Slz6i4UEbYzeanEF60DAtv4O2ZmhsRo5y+CAvEoXveSMnaqa0+9SXmhknrYYoEXh5N46+QbqqTIqD3c2O9egHg==@lists.postgresql.org X-Gm-Message-State: AOJu0YypjxpEnGtA5AmvMRJO1tLDxXPGfD7cdFq3mwiUYJyZvMPX1cgI R/uCLll3jM8Ov4+YUJzEnzM8LKfU4VhSMCGBBoIME+l6+u6XAvkH3IXpBSpHDoYWzzQKVlGAj67 +1IvOUQ== X-Gm-Gg: ASbGncuu2oNcum0VLQqv4J1rEVL8h/bqeS55Qr7CB6ktZSojD6U3EpM53KD0rJ1MFcT lVCKXMLJ+wgfxPiZ+ny++ExEFz9AwfU453LWhZLGpR9lfwpe+GvCfjlE8nNeLPQ3jJtD8peFS4m u4khJWy+/F7/ZLXPueyAfcQ89+xcvZwUMR2Uie6QLE1RqDpmKAfAFIr7E8+bFZVg9niv6m80NH1 CaAjxyAyEWcXZz2rovyEdUa1o8weWOY1u+Da4ZofU6BZT84to0IyxIOmhFdSIg0nsOWRgGQ5QqN LTfJv/PIyKKmzRQxmBmQZ7CvcUg= X-Google-Smtp-Source: AGHT+IFbPfNhbpcMVyLzHW5iJxTKpXuTbsb+bpTMCJd0epU4x9csWJLT0G+P1OXMddoPQNftJTaTCQ== X-Received: by 2002:a17:907:1b1b:b0:aac:619:e914 with SMTP id a640c23a62f3a-ab38b10cf76mr3424787366b.16.1737828092138; Sat, 25 Jan 2025 10:01:32 -0800 (PST) Received: from localhost.localdomain ([2001:871:255:9ae3:244c:7859:2776:53b7]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ab675e67836sm323493266b.66.2025.01.25.10.01.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Jan 2025 10:01:31 -0800 (PST) Message-ID: Subject: Re: Read-only connectios optimizatios From: Laurenz Albe To: Edson Richter , "pgsql-performance@lists.postgresql.org" Date: Sat, 25 Jan 2025 19:01:31 +0100 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.54.3 (3.54.3-1.fc41) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 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? The only difference that I am aware of is that read-only transactions at th= e SERIALIZABLE isolation level can release predicate locks earlier, which can benefit performance. But I don't think that you need to worry: reading transactions only take an ACCESS SHARE lock on tables, which won't conflict with data modifications. Yours, Laurenz Albe