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 1w6y3R-004pV4-1S for pgsql-hackers@arkaria.postgresql.org; Sun, 29 Mar 2026 21:52:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w6y3P-00HNbL-2i for pgsql-hackers@arkaria.postgresql.org; Sun, 29 Mar 2026 21:52:20 +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 1w6y3P-00HNbC-1b for pgsql-hackers@lists.postgresql.org; Sun, 29 Mar 2026 21:52:19 +0000 Received: from mail-qk1-x72c.google.com ([2607:f8b0:4864:20::72c]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w6y3O-00000001hmR-10ZK for pgsql-hackers@lists.postgresql.org; Sun, 29 Mar 2026 21:52:19 +0000 Received: by mail-qk1-x72c.google.com with SMTP id af79cd13be357-8cd7c372929so421153885a.0 for ; Sun, 29 Mar 2026 14:52:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1774821137; cv=none; d=google.com; s=arc-20240605; b=MWAk5mv+ySIOBg53PdlhjCSwUG1KH5krp3ncSuc5zqA8oo0gpe4X//WTQn5J8utzoo /oqYCE2sKBF7k+5l/m0F0kKfdic2pm8QbD7q7kU8BTASK9sEq+QPPgN9d2KAOMCY8lMa v4fTQiM/V3SSLFFjym0nv83+VfJKykDRtT7qS4GrU8zU16jj+fxKsdN5D7nZ8cHI5L+y qlEGZ9cxJTW7z/A2BMkf7ENJoxkRCjZ9hssKlnlaMBRm63hajjCgd5it2Y4FhKu7X+bK 0IgiJ5ZCp3Jtjw2lnTqMDUiXsax8CVTJTc+2rCfbuwsLIYI+USoYlJactx+BPvhXH+04 h1Mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=Uv0mfV43JA440KSVru21YHU/inIn0x0BdlAs2T3NM6g=; fh=HEG/yqzSuV2+uZDlfbIrKtcLSDcvVnyZU5pao+ItmJc=; b=bw+ICki4/zWa7ZNyRBQIYsMW69GdiuFQPsrZS1t4aJxV0ZDXEjgb2sr+mnWYQudHfr xjW8B93wcg+MlDBQ52Gr9khfOpIP6EPF8ZId3oqJbLNgmz1LFJSFuDusX8DQk2xo6AgJ Hgv9+T+Gv9Yrmmu3MFrNDY+SgalQcSfHmWIUUERY5kW0Ecla7tz3j1j+PtNPHkiel4Vp AHD3l1Tr7Pya2y1t1gJ6cICjGkfRU4QpA9nZCyvYbEUR9kPb2Iiks/J7X+JLZUATi7Du VHlAhMVkNNldTtPt3lNiKpvq1Cbvh9d/b+f8VeEWvcvvoiibNZN1USGLHHC5U+PGCdNj /Grg==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774821137; x=1775425937; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Uv0mfV43JA440KSVru21YHU/inIn0x0BdlAs2T3NM6g=; b=mHHDA6c43OIseeUT7AWrISfMrMR6DD2OdvzAXA4260PD8Ysqq4GdnivLZAgxfgNDYp oMCPpy0I6KjtRvpMWokYxrTVo7M4ezvDQMuJYLljOu69VIvlqTy6WAynhXSU6n/KtY9s xCr+MPqENShEBM7os0C8qvmJihKaUbbhAv1CpgWf5UkxGcJ1Z0qdGePudsnHNSUbXcY8 vb4XM6eXU7y7xAxQn7/yy614GCTwwB+xGm2CWJ5cQhHwNW+Ee8tyYdy8I/UcIynZyQbw s+cErkPLYV7LMjG0iTIK0GnDs37Holxd1i+V1NztHRUAfcEVKf4D9j2+4LmL8E7NPJBw vx8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774821137; x=1775425937; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=Uv0mfV43JA440KSVru21YHU/inIn0x0BdlAs2T3NM6g=; b=cRtJ5gzF5qET/7v5NJSrX9Sxla0LSeXyXXElUIxIJXGWJjivHivYEn3THQkWVc3KEj WPKM8eAwDrkcdZSl5JAZ1hKzfTLRVfWv2exBE4OqKILBQaokhs6GB407IzgwioZ5C0Bg L2Ne4uEpIvzl5zWZlVt9PkFouQzLc9NDl/eNCi9AyEmc4u1uUvIho55YkZ9bZxeEKE0P YrDdmJHgaZWYMDWYDgyDKQA+cplYTYT9G+E8kIdP3d7FLK4QYkBfgqqFJUrHpd30LU5S 9VmamlhzhIKnN1VaAvY+F1X8Dadf/iA+dvDP7z/3T5GZznc6Tb7GHKAcX78TETUEObrn 4eCA== X-Gm-Message-State: AOJu0YxjlFQoxH97AmxN/YT1O7123nYexrH+7jWNgc0xkbisXsbsZzfI OE6KCICTdFQycYU0C9S8IDSrr1DwQNtNid1YmaYS1cR4TmE2h/ctj3ys1efTlQFTM9XQevgVN0a S+5kGZ5WB4VgwPQb4pCGOYaoKUg37CrQ= X-Gm-Gg: ATEYQzzvgs2mu2Z8xBUzrKZKSsJ0XFInV9C+KlgbJUY7L58D6akLU5Ldlk9GPLDcO0Z 0mbJGljKqQ1LYD6DC2Wm1wCfa3wUAenXPv6kO5UlNarP2/7bOx82G14McguSuo5QSU/7lhXeJCk awdIrmWd915b70DPd+2QK6TOrcvfOGedlm701TmvSKnmhkbndqaozFlHZtwLgqh4Bz1czKAMkwh FM1EmGC1dwWiELppxqtopCXX5DiUfvFNctUrcv1LVg0DpxRrgskZWbrUuIDW1RC0uIYlrCgSsQQ ELL9mqVLgNBQ/4Z82Ppy1KRqhj0pf98/UWfOBUDbVQ== X-Received: by 2002:a05:6214:5d8d:b0:89c:cc5e:4670 with SMTP id 6a1803df08f44-89ce8d47371mr145029006d6.17.1774821137387; Sun, 29 Mar 2026 14:52:17 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Peter Smith Date: Mon, 30 Mar 2026 08:51:49 +1100 X-Gm-Features: AQROBzDhlERctbkIvwGPhdxnKIkWfAE0MgFzIXkPPzhbw7ZwS_r8-J7dOg30o5w Message-ID: Subject: Re: Get rid of redundant StringInfo accumulation To: Daniil Davydov <3danissimo@gmail.com> Cc: Postgres hackers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sun, Mar 29, 2026 at 11:26=E2=80=AFPM Daniil Davydov <3danissimo@gmail.c= om> wrote: > > Hi, > > I have noticed that there are several places in the code where we are > creating StringInfo in order to log its content. But this work may be was= ted > if the specified log level is not interesting both for client and server. > I.e. now we can allocate memory for StringInfo which will never be displa= yed. > > I think that at first we should check whether log level is interesting an= d > only then start creating the StringInfo. > > Please, see the attached patch that fixes it. I hope I have found all the > places where it would be appropriate. > Hi, 1. @@ -108,6 +108,9 @@ ReportApplyConflict(EState *estate, ResultRelInfo *relinfo, int elevel, Relation localrel =3D relinfo->ri_RelationDesc; StringInfoData err_detail; + if (!message_level_is_interesting(elevel)) + return; + AFAICT, this change will also cause the pgstat_report_subscription_conflict() to be skipped. But that call was not associated with the log level. =3D=3D=3D=3D=3D=3D Kind Regards, Peter Smith. Fujitsu Australia