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 1qqsVt-001VGQ-GB for pgsql-hackers@arkaria.postgresql.org; Thu, 12 Oct 2023 10:01:53 +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 1qqsVr-005Ro7-7u for pgsql-hackers@arkaria.postgresql.org; Thu, 12 Oct 2023 10:01:51 +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 1qqsVq-005Rnr-Su for pgsql-hackers@lists.postgresql.org; Thu, 12 Oct 2023 10:01:51 +0000 Received: from mail1.dalibo.net ([51.159.93.128] helo=mail.dalibo.com) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qqsVn-00097N-Kt for pgsql-hackers@postgresql.org; Thu, 12 Oct 2023 10:01:51 +0000 Received: from [192.168.1.16] (unknown [90.58.191.166]) by mail.dalibo.com (Postfix) with ESMTPSA id C013C20198; Thu, 12 Oct 2023 12:01:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=dalibo.com; s=a; t=1697104907; bh=0jchI1ihXzqaF8AZ9xE/KrrNWRzphP9bXXpkQL1S4gc=; h=Date:To:Cc:References:From:Subject:In-Reply-To:From; b=P8Q/RMhsmBD4rylfPcTvDQodsY0g1Lax8F1N2+QirHls4qt+5+omXS0H6MPnmVhOD ZGvWlCNCmaTwncBw9I1mUB5zAnoOGrmCwz2hFp9rMllBV/1mfqm7FcXwclGNs8PSzo 24XZWBgBpN9tXYI64BJ6hnkMGZqkRFOcROfnisCI= Message-ID: <11e34b80-b0a6-e2e4-1606-1f5077379a34@dalibo.com> Date: Thu, 12 Oct 2023 12:01:46 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Content-Language: fr To: "Imseih (AWS), Sami" , Alvaro Herrera Cc: Robert Haas , Amit Kapila , pgsql-hackers , Melanie Plageman References: <10D5C31A-A303-4440-BCA2-921440A9E1CC@amazon.com> <202310111011.lyo66rk7k7pu@alvherre.pgsql> <9E9E69BD-BABB-49BB-8B69-61939179F20D@amazon.com> From: =?UTF-8?Q?Benoit_Lobr=c3=a9au?= Subject: Re: Logging parallel worker draught In-Reply-To: <9E9E69BD-BABB-49BB-8B69-61939179F20D@amazon.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 10/11/23 17:26, Imseih (AWS), Sami wrote: Thank you for resurrecting this thread. >> Well, if you read Benoit's earlier proposal at [1] you'll see that he >> does propose to have some cumulative stats; this LOG line he proposes >> here is not a substitute for stats, but rather a complement. I don't >> see any reason to reject this patch even if we do get stats. I believe both cumulative statistics and logs are needed. Logs excel in pinpointing specific queries at precise times, while statistics provide a broader overview of the situation. Additionally, I often encounter situations where clients lack pg_stat_statements and can't restart their production promptly. > Regarding the current patch, the latest version removes the separate GUC, > but the user should be able to control this behavior. I created this patch in response to Amit Kapila's proposal to keep the discussion ongoing. However, I still favor the initial version with the GUCs. > Query text is logged when log_min_error_statement > default level of "error". > > This could be especially problematic when there is a query running more than 1 Parallel > Gather node that is in draught. In those cases each node will end up > generating a log with the statement text. So, a single query execution could end up > having multiple log lines with the statement text. > ... > I wonder if it will be better to accumulate the total # of workers planned and # of workers launched and > logging this information at the end of execution? log_temp_files exhibits similar behavior when a query involves multiple on-disk sorts. I'm uncertain whether this is something we should or need to address. I'll explore whether the error message can be made more informative. [local]:5437 postgres@postgres=# SET work_mem to '125kB'; [local]:5437 postgres@postgres=# SET log_temp_files TO 0; [local]:5437 postgres@postgres=# SET client_min_messages TO log; [local]:5437 postgres@postgres=# WITH a AS ( SELECT x FROM generate_series(1,10000) AS F(x) ORDER BY 1 ) , b AS (SELECT x FROM generate_series(1,10000) AS F(x) ORDER BY 1 ) SELECT * FROM a,b; LOG: temporary file: path "base/pgsql_tmp/pgsql_tmp138850.20", size 122880 => First sort LOG: temporary file: path "base/pgsql_tmp/pgsql_tmp138850.19", size 140000 LOG: temporary file: path "base/pgsql_tmp/pgsql_tmp138850.23", size 140000 LOG: temporary file: path "base/pgsql_tmp/pgsql_tmp138850.22", size 122880 => Second sort LOG: temporary file: path "base/pgsql_tmp/pgsql_tmp138850.21", size 140000 -- Benoit Lobréau Consultant http://dalibo.com