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 1stysc-003Blo-4F for pgsql-hackers@arkaria.postgresql.org; Fri, 27 Sep 2024 00:30:43 +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 1stysa-00GsuG-85 for pgsql-hackers@arkaria.postgresql.org; Fri, 27 Sep 2024 00:30:40 +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.94.2) (envelope-from ) id 1stysY-00Gsu8-Sd for pgsql-hackers@lists.postgresql.org; Fri, 27 Sep 2024 00:30:39 +0000 Received: from fhigh-a7-smtp.messagingengine.com ([103.168.172.158]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1stysS-001Ea1-4M for pgsql-hackers@lists.postgresql.org; Fri, 27 Sep 2024 00:30:37 +0000 Received: from phl-compute-01.internal (phl-compute-01.phl.internal [10.202.2.41]) by mailfhigh.phl.internal (Postfix) with ESMTP id 3FF92114026B; Thu, 26 Sep 2024 20:30:30 -0400 (EDT) Received: from phl-imap-09 ([10.202.2.99]) by phl-compute-01.internal (MEProxy); Thu, 26 Sep 2024 20:30:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eulerto.com; h= cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1727397030; x=1727483430; bh=8Ddk42freR KOYMpYSAEUp6DUtMA2LGikqANCFH5N3gU=; b=YJyZaf6xQDrPy5DowwkZwcCPCt JdKc28oJwSUUAB+y2xPQAuwpBofmL+jMgf6fePeUWdOEt8VrdjA8zbjWWFlWDHAA 9YiXH1l3MjW71tkqHqqUgBtikBMGvX6S39MMn39jcUhueWSLg8SEVMxZmWNDTuRS mqD1vLrJvbHjm8kIEvGpDztZeOhe+bVD/ccyTUJEJ1AxzhTR7XEIzujLqJZIT0nT nItwQJAlmTv0Wd9OV45u5jZAHs9tE+zC6DuY4zD1OGCT2RarZsTBS+42s/eYZYHk dz9YXsW8luoDXSdg3G8sX3N3gruBUeskseWmW8/HDMbRvFrf1HVB2k/FpC2w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1727397030; x=1727483430; bh=8Ddk42freRKOYMpYSAEUp6DUtMA2 LGikqANCFH5N3gU=; b=gzWM2JxdN4wq5gka8Wa1znYUublHNsMYwr3ZDCoS+hlk hke1Ak96kPeRzl4z18qMSF4NKeZW7rzqv2nFhMEdbV5+cfpW6V4LCketv7jX/o9G 4IcrLtOG18WG+vEMS6q4uHtYpgnQhGIOh3yJR24CbFAlFprhXPYmHEiFTA8HerlW dU6O89aGeMiKVzY4REc5FxDNjrwZcZxyZeu7pB5FKom0No4TRDvtgX1pE95bgcdh kZqnnygkUlZf52UZxgahspYsSeHobX1Y+h79Mu1fAC34cM3dQhk43dGctV0BfkXW 2yDmaTBPmWonjxbi+Q3L4YsT//WgulRmys8Z4xLfkg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvddtkedgfeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefoggffhf fvkfgjfhfutgesrgdtreerredttdenucfhrhhomhepfdfguhhlvghrucfvrghvvghirhgr fdcuoegvuhhlvghrsegvuhhlvghrthhordgtohhmqeenucggtffrrghtthgvrhhnpefhtd duleeufeeltedutddukeekfeeugedvgfejteeggfffteeiffdugffgueffteenucffohhm rghinhepvghnthgvrhhprhhishgvuggsrdgtohhmnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepvghulhgvrhesvghulhgvrhhtohdrtghomhdp nhgspghrtghpthhtohepvddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepughiph hhrghnthigmhesghhmrghilhdrtghomhdprhgtphhtthhopehpghhsqhhlqdhhrggtkhgv rhhssehlihhsthhsrdhpohhsthhgrhgvshhqlhdrohhrgh X-ME-Proxy: Feedback-ID: i0c21471d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id C174E780068; Thu, 26 Sep 2024 20:30:29 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface MIME-Version: 1.0 Date: Thu, 26 Sep 2024 21:30:05 -0300 From: "Euler Taveira" To: diPhantxm , pgsql-hackers@lists.postgresql.org Message-Id: <94d53a41-d1f5-4fd1-8d1e-ff36ac569848@app.fastmail.com> In-Reply-To: References: Subject: Re: Truncate logs by max_log_size Content-Type: multipart/alternative; boundary=dd500bf3a9cd451d800441a1b9285d20 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --dd500bf3a9cd451d800441a1b9285d20 Content-Type: text/plain Content-Transfer-Encoding: 7bit On Thu, Sep 26, 2024, at 3:30 PM, diPhantxm wrote: > I would like to suggest a patch to truncate some long queries. I believe sometimes there is no need to log a query containing some gigabytes of blob, for example. In patch a new parameter, named max_log_size, is introduced. It defines the maximum size of logged query, in bytes. Everything beyond that size is truncated. I don't know how useful is this proposal. IMO the whole query is usually crucial for an analysis. Let's say you arbitrarily provide max_log_size = 100 but it means you cannot see a WHERE clause and you have a performance issue in that query. It won't be possible to obtain the whole query for an EXPLAIN. It would break audit systems that requires the whole query. I don't know if there are some log-based replication systems but it would break such tools too. There are other ways to avoid logging such long queries. The GRANT ... ON PARAMETER and SET LOCAL commands are your friends. Hence, you can disable specific long queries even if you are not a superuser. If your main problem is disk space, you can adjust the rotation settings or have an external tool to manage your log files (or even use syslog). -- Euler Taveira EDB https://www.enterprisedb.com/ --dd500bf3a9cd451d800441a1b9285d20 Content-Type: text/html Content-Transfer-Encoding: quoted-printable
On Thu, Sep 26,= 2024, at 3:30 PM, diPhantxm wrote:
I would like to suggest a patc= h to truncate some long queries. I believe sometimes there is no need to= log a query containing some gigabytes of blob, for example. In patch a = new parameter, named max_log_size, is introduced. It defines the maximum= size of logged query, in bytes. Everything beyond that size is truncate= d.

I don't know how usef= ul is this proposal. IMO the whole query is usually
crucia= l for an analysis. Let's say you arbitrarily provide max_log_size =3D 10= 0
but it means you cannot see a WHERE clause and you have = a performance issue in
that query. It won't be possible to= obtain the whole query for an EXPLAIN. It
would break aud= it systems that requires the whole query. I don't know if there
are some log-based replication systems but it would break such too= ls too.

There are other ways to avoid loggi= ng such long queries. The GRANT ... ON
PARAMETER and SET L= OCAL commands are your friends. Hence, you can disable
spe= cific long queries even if you are not a superuser.

If your main problem is disk space, you can adjust the rotation= settings or have
an external tool to manage your log file= s (or even use syslog).


--
Euler Taveira

--dd500bf3a9cd451d800441a1b9285d20--