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 1w9mKf-001jq6-0L for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Apr 2026 15:57:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w9mKd-00A7VB-1j for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Apr 2026 15:57:43 +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 1w9mKd-00A7V3-0h for pgsql-hackers@lists.postgresql.org; Mon, 06 Apr 2026 15:57:43 +0000 Received: from mail-oo1-xc31.google.com ([2607:f8b0:4864:20::c31]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w9mKb-00000000vJL-0OKY for pgsql-hackers@lists.postgresql.org; Mon, 06 Apr 2026 15:57:43 +0000 Received: by mail-oo1-xc31.google.com with SMTP id 006d021491bc7-682baaa9f1aso722351eaf.3 for ; Mon, 06 Apr 2026 08:57:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1775491059; cv=none; d=google.com; s=arc-20240605; b=h1RPZwxBALQpwEVQOEe66hs+55k+4vPFLib+n/t97cv7ct9/qb+cpdaOm8eRzYuzeZ SX/YKVc6SsGGlBtFlyOzKMcPkr7CEEsUeoDRXZo4fQIuS/V3lXUP2zm07GmDF6WVZ6uK abb7qlOoI+NTjJVmlSfsjO/SRxnjHrI7w3Mcx8j/6KE3xolc+M8hVMezPnaKwUhrh14s yWXAIzq0cNozw+2Lka/TquqL7zH4LKZf28lT0wREmBaNaYVZ/P0rNlVW6rxRNRAPT6yv V/aZSltObBeDZFgeYNpzVRxfHIGBgI4dlPG39rWcsDsI0RSgSntIrttxCrQ/tHqs5hMZ AqjQ== 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=j0KOq+awhz1FWVCj6g2sEaV8F5GieUWgzR3jnvkVj/w=; fh=6ppgGpCP+xdusU7/w6dCOLQL/hRUIlfhqWvhpenoAcg=; b=CwZrTyuAq/udFfohHVfPCIWUD4Cs2LxuHwTMrexuwqlw8nJLIx3xMoUl0uab+brRCS Bx8Gd6d+9FWrbGIcMhOivY07lyjG5gxy5K5LPKimsnu9T1+Ow0DJ96WySa9T8kVTDaPh 4vklbLnvcRJxhvFQRZuJcf8uqTQzsgc3P26d+3K3z/oyHATurqPmRGk6I09x+M6LvFLi o+8YxkomCde0IgfI8PWXxU9riUhCi83SluxOmumqtppRjBDYGQad9JTFSUmQWBppDFiX 2/u5takbeaLCpiq9FG//BwLqJwvpcPJQc8FC6f94OXoOj/HCjTxaE7/Y5ruasil3AFKH McqA==; 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=1775491059; x=1776095859; 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=j0KOq+awhz1FWVCj6g2sEaV8F5GieUWgzR3jnvkVj/w=; b=AO80t8/MUkCmR94j2oA6IzHu7uVOJCmQt63nTZwgiyxe1n58Y6/a6Fc0jHMjSGvzTT q62Z9TGfO2fOP4h7Wo/zXAyMPmH9nWifih6km1KUO6O+Q/3kiznbC68fW10UI3LCThLA c/7QbM9RMsrJpazVu3CTDaPG25cLWGOEALfxM5TeL9waBrt/Z7y5906rc36O85xgSZTf wvApmnmXfOl6lIqdbpIMAp17c74QP6cInbBIfqjJgQQZcyXR5OR39cHsqLq5hffAnD8y sNCkH6pfezscyxSTS6guZ6KuTbW7tveALa78g+Mts1LyhrCWADGucr43BEa0S0ZflQ2G cl7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775491059; x=1776095859; 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=j0KOq+awhz1FWVCj6g2sEaV8F5GieUWgzR3jnvkVj/w=; b=oR+rVGFPmOqCPmv81LoS/lnDxlBBoHebvMKLSNG2z3nS669bEbLQ6OhwCV34PWWMB2 B2BKI0Qpy8Me41zxqFOmYZu71zb/JMR9fCmSztVi7cxHtYgmJTiRdnklBJ+9EjyNopQz GgERH2XWj4v0iuz6jZSk4Gp5bSdZLIj2c2UkNJ6vsgZtVWudo+szssb4+peV42qAzTUf S4nX0E3CpHB8IgGUcpZss1Y9Z9BFz+X9Q8uVRhSCGDtjRYnaqlxcABla/tbhoMytQNu6 wZ48b4/YYUXqw6dfbGSMbUKl+HuHvtue8jSvE48xtiP6cgvRxuCvRapzdmZWHC3+MGmz v3zg== X-Gm-Message-State: AOJu0YyyFkNnCIVMQ6DPZOYur6Dn2Z37DPOzEhgxIr9+UCiQRjfUHDDm e7GEJz47Mpc5RCadRfEXJC3KktpcWuNSlP2cqDnlTHMEt3qxWj/Z+401TSRCSTw1NoIEtOX1uiK haJQ5e7OWODYpo2olOgoUC0+2aqu8nA6q7hUTciA= X-Gm-Gg: AeBDievrmwjDifB2DGCT3d6TabSKWJF3plkmJ70o3kglga+EPwqOH1pq7VdKlm0nF+d szCVLOlZnZVpQMr0Mmb64in4vVNmXncPx/2Tn4xU9goQubkmS14ImZpMHvz4PSAOaa6iXgLp4vK RKUMtGGLbt8Ec2Du7yZwEamyOEk6RoDpK7Yn8IFNgfGrKr1WPGxgD0Vt4jWJ3J+6pFp9Sc5iTAg ZvazggVp0zH/0J7RxPRcjTnTYVFfaDw/OjN9LJzzA+xYzI/IWVgxF5Otrzz9ngnRRhDC7a/lXTT jyjST4BMdpfJpDxNc4FWEbck4PeRMUx3zUI9AOFobQ== X-Received: by 2002:a05:6820:4c14:b0:67c:9f59:23ee with SMTP id 006d021491bc7-6821e869bd2mr6646178eaf.14.1775491058982; Mon, 06 Apr 2026 08:57:38 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Fujii Masao Date: Tue, 7 Apr 2026 00:57:26 +0900 X-Gm-Features: AQROBzBidpV470bXNg5DLZRkV0QrtEuQ8CSRm-pK_V17Yx-W6bgt_EmXi8lOYms Message-ID: Subject: Re: pgsql: Reduce log level of some logical decoding messages from LOG to D To: Robert Haas Cc: PostgreSQL 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 Mon, Apr 6, 2026 at 11:55=E2=80=AFPM Robert Haas = wrote: > > On Thu, Apr 2, 2026 at 8:45=E2=80=AFPM Fujii Masao wrote: > > > If something goes wrong, enabling the messages for the future > > > won't tell you what went wrong in the past. I am wondering whether a > > > better approach might be to set the LOG level based on context -- tha= t > > > is, if it's actually logical decoding, log this at LOG, but if it's > > > just someone peeking at a slot or similar, reduce the log level to > > > DEBUG1 or, really, probably more like DEBUG3. > > > > You are suggesting something like that logical walsender and > > pg_logical_slot_get_changes() should log at LOG, while the slotsync wor= ker > > should use DEBUG? Sorry, I may be misunderstanding, since the slotsync = worker > > can also use logical decoding mechanism internally. Could you clarify w= hat you > > have in mind by "peeking at a slot or similar"? > > No, what I mean is that if someone runs an SQL function from the > foreground, they probably don't want that to result in a LOG message, > but if background activity results in such a message, the LOG message > is probably a good idea. The reasons are: > > 1. Somebody might run many foreground queries that rely on the logical > decoding infrastructure, so logging something every time such a query > is executed could produce a lot of log spam. But there shouldn't be so > much background logical decoding for this to be an issue. > > 2. If logical replication is not working, that may be a major issue > for the DBA. A problem running pg_logical_slot_get_changes() is likely > not as critical (and if it is, they can always lower > client_min_messages or log_min_messages for that session only). This seems similar to Bharath's suggestion in [1]. You can already do this = by setting log_min_messages =3D 'warning,walsender:debug1'. With that setting, DEBUG1 logical decoding messages from walsender are logged at LOG, while backends follow log_min_messages=3Dwarning, so logical decoding SQL functio= ns don't emit those DEBUG1 messages. But probably are you suggesting making this behavior the default? If yes, one straightforward approach to implement that would be to log these messag= es at LOG when AmWalSenderProcess() or AmLogicalSlotSyncWorkerProcess() is tru= e, and at DEBUG1 otherwise. The downside of this approach is that it becomes harder to suppress these messages for walsender or slotsync worker if some users want to do that. For example, raising log_min_messages to FATAL or PANIC would suppress them= , but would also hide ERROR messages, which isn't desirable in production. Regards, [1] https://postgr.es/m/CALj2ACX_SSJYKt5od1C2874yeotTO9JewfRY9B=3D3DYx2daUA= Mw@mail.gmail.com --=20 Fujii Masao