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 1vnxvS-00EAlc-2k for pgsql-hackers@arkaria.postgresql.org; Thu, 05 Feb 2026 11:53:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vnxvQ-00Gp9h-27 for pgsql-hackers@arkaria.postgresql.org; Thu, 05 Feb 2026 11:53:32 +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 1vnxvQ-00Gp9Z-10 for pgsql-hackers@lists.postgresql.org; Thu, 05 Feb 2026 11:53:32 +0000 Received: from udcm-wwu2.uni-muenster.de ([128.176.118.28]) by makus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1vnxvN-00000000fu0-1J3Y for pgsql-hackers@lists.postgresql.org; Thu, 05 Feb 2026 11:53:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=uni-muenster.de; i=@uni-muenster.de; q=dns/txt; s=uniout; t=1770292409; x=1801828409; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=Zg57yEt7gVWAVS+h3MJEGQ8QWvKKKrW+kizjz6Q83dU=; b=dAeoSSKy7C+fBKVzzFIaT0KHdBVOHt6pjylhc1t6oQaBexmi41YdOHJE XZQz7a3xBav4n/W8TDh2Hcf1PbpY8q1DBl/99DNykN1q2kgAjdHeU3XwW wAqTs2peR9g2ahYVZ6giSSRXhODzzksXs00GohTd1SUcjxfQvJSBD4FuC hiwZZ29UVPLN6oVXxzrAwGLHp6xG7+j4HnfPgI7US9C/xYvOpP5wkD4DS XPds25giZegFsL26UrmAo/7arWZ/oQ/5cKIY874LkTZZaNcG8ARUnjWzJ GnT+ohe1M5u/KAKYduxKHCE/SGhy1MqWPlGfRqjkWhrM2V9I8Pec1OGAZ A==; X-CSE-ConnectionGUID: liSQHpfHSKSnc7OER+X/ow== X-CSE-MsgGUID: /vv2LXrcSwmQ4LManSvvOw== X-IronPort-AV: E=Sophos;i="6.21,274,1763420400"; d="scan'208";a="383790635" Received: from secmail.uni-muenster.de ([128.176.118.4]) by UDCM-RELAY2.UNI-MUENSTER.DE with ESMTP; 05 Feb 2026 12:53:26 +0100 Received: from [192.168.178.27] (dynamic-080-171-013-157.80.171.pool.telefonica.de [80.171.13.157]) by SECMAIL.UNI-MUENSTER.DE (Postfix) with ESMTPSA id 9EF6D20ADF02; Thu, 5 Feb 2026 12:53:23 +0100 (CET) Message-ID: <95e3c93f-3b74-41c4-a7f7-63c7ae456a88@uni-muenster.de> Date: Thu, 5 Feb 2026 12:53:22 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Truncate logs by max_log_size To: =?UTF-8?Q?=C3=81lvaro_Herrera?= Cc: Fujii Masao , Fujii Masao , Kirill Gavrilov , Kirill Reshke , "Andrey M. Borodin" , Euler Taveira , pgsql-hackers@lists.postgresql.org References: <202602051012.qer26xklakqb@alvherre.pgsql> Content-Language: de-DE, en-GB From: Jim Jones In-Reply-To: <202602051012.qer26xklakqb@alvherre.pgsql> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 05/02/2026 11:22, Álvaro Herrera wrote: > My only comment at this point is that the proposed GUC name is not > great. I think it should be something like log_statement_max_length, or > something like that. Reading just the thread subject, people would > imagine this is about the size of the log file. +1 for log_statement_max_length > > Another point is that the current patch does strlen() twice on each > query. It might be better to do away with need_truncate_query_log() and > have a single routine that both determines whether the truncation is > needed and returns the truncated query if it is. If it returns NULL > then caller assumes it's not needed. I'll take a look at this. Another thing that we could adjust is the default/disable value: I personally find 0 to disable the feature a bit confusing. 0 might be interpreted as "log 0 bytes", and the user ends up with the full statement logged. What about -1? Best, Jim