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 1tTet9-007Xma-5A for pgsql-hackers@arkaria.postgresql.org; Fri, 03 Jan 2025 10:26: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 1tTes9-0005NV-6O for pgsql-hackers@arkaria.postgresql.org; Fri, 03 Jan 2025 10:25:40 +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 1tTes8-0005NN-NB for pgsql-hackers@lists.postgresql.org; Fri, 03 Jan 2025 10:25:40 +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.96) (envelope-from ) id 1tTes6-0000xz-27 for pgsql-hackers@postgresql.org; Fri, 03 Jan 2025 10:25:39 +0000 Received: from [192.168.1.23] (unknown [90.58.191.166]) by mail.dalibo.com (Postfix) with ESMTPSA id CC02D26ACA; Fri, 3 Jan 2025 11:25:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=dalibo.com; s=a; t=1735899936; bh=Do+gasxpGj29uk8f7Psjo8xuLp2P7GGCeIoMF6OYD7Y=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=RlS8qQtJR1UIuZG+/8nQuAHTModxLs9MM0gaawLoKNl+msAcZh66lLSwvP9t+gvAh fZST1X4mcy9i1gP8lGayhd21m3USu55e8JxqVvTi7Az0MiMlda3/NpIPd8bOJo6ryy yOdqDCzpgyXv/deH+e3qseN/kI3Mr0SUx4bEs2XU= Message-ID: <82ffc7a2-b77d-437b-a684-4a79a32fd87b@dalibo.com> Date: Fri, 3 Jan 2025 11:25:35 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Logging parallel worker draught To: Sami Imseih , Tomas Vondra Cc: Guillaume Lelarge , Alena Rybakina , pgsql-hackers , "Imseih (AWS), Sami" , Alvaro Herrera , Robert Haas , Amit Kapila , Melanie Plageman , "Andrey M. Borodin" References: <10D5C31A-A303-4440-BCA2-921440A9E1CC@amazon.com> <0d08b978-10cb-4512-bcef-ca1f192049ab@enterprisedb.com> <0b7ef57e-bf30-440b-9478-d8f587f2637c@dalibo.com> <2cccd814-d7b3-4c9a-a66a-6df4c45fd95e@enterprisedb.com> <17f9faf1-4edb-46d0-80ed-91bba16423a3@dalibo.com> <7ECC97AE-2670-4792-BC6F-FD91B23F8E8C@yandex-team.ru> <39ac8951-6b99-469b-b9f1-2791efe43fbd@dalibo.com> <8123423a-f041-4f4c-a771-bfd96ab235b0@dalibo.com> <2a8e9e1c-0f05-4ebd-9a4d-d023d26c0def@dalibo.com> <04e6d7e2-f67a-438c-bc11-9354ab64ef1f@dalibo.com> <63d182f8-1a65-4e34-a335-403f53b14ba7@dalibo.com> <31dc1548-30dc-4423-b939-2842c469f129@dalibo.com> Content-Language: fr From: =?UTF-8?Q?Benoit_Lobr=C3=A9au?= Autocrypt: addr=benoit.lobreau@dalibo.com; keydata= xsBNBF3FR7IBCADDvtR0p09SI9OvnbWw+VEvO5IXefBWFWefxrPd0H3Sf3gsBLiKbRdkSjvz 2y+ksRgBUkhK1Kiqe/QuddgvuT9OUFBCrOtZxkBgJYRbxBNTOnIehhEoK9sdqjwvwNyxJUEX er1UgErP+MJTvwpW1J8Uq9oV+NbqgNQ7ca5G2D3x7DI2Tbbw0iu+lmCIdXQpTk7hacErGscC p/eaJQFd6EPAZPS7BQEgjuDDjGCy4RzTSiobtqn0ocaEj+w7365FVKKZD2LjEm1mfBK/4nml H/vlssXkKKpUGetaib6AVpZK3a0xBTMi04ft/V8iGGJu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I+6WK7/s0Jsx5L8aIfDKY4zjqQ9InP+LkA azkKW4JpIb9Ny0FzRjUyf9gReU5nMy9sUNS4DhoHG6c/bQYqkj9uA5AokiDDCRg2dobfpaNP C6qQQIXD+wi0aZ4jR5r4rXMxmwFutandoaxDpPBj4EXlyRHhzyKfgb2c6TXdCVQ5YJUFUi9k gl7CXplN8vBpMuzN5y6NPd3Xekcp16D5XCQNBQ2drIsnFR4IbDPI1Mqd6OJYH0vum6g8FmoN s7ygc4oi12nU In-Reply-To: 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 Hi, thank you for the review and sorry for the delayed answer. On 12/28/24 05:17, Sami Imseih wrote:> Thinking about this further, it seems to me this logging only makes sense > for parallel query and not maintenance commands. This is because > for the latter case, the commands are executed manually and a user can issue > VACUUM VERBOSE ( for the case of vacuum ). For CREATE INDEX, one > can enable DEBUG1. For example: > > postgres=# CREATE INDEX tbl_c1 ON tbl(c1); > DEBUG: building index "tbl_c1" on table "tbl" with request for 1 > parallel workers > DEBUG: index "tbl_c1" can safely use deduplication > CREATE INDEX In my opinion, it's useful: * Centralization of logs: The maintenance operation can be planned in cron jobs. In that context, it could certainly be logged separately via the script. However, when I am doing an audit on a client database, I think it's useful to have all the relevant information in PostgreSQL logs. * Centralization of the configuration: If I am auditing the usage of parallelism, I would like to have a single GUC to enable the logging for all relevant information. * Context: Maintenance workers are part of the global pool of workers. To know why there is a shortage after the fact, having all the information on what was using workers could be useful. I tied this argument when we added the parallel worker info to pg_stat_database and wasn't successful. It would be nice to have the info somewhere. The logging for CREATE INDEX and VACUUM is in separate patches. If you don't mind, I would like to keep it as long as possible. > 2/ For logging parallel query workers, the log line could be simpler. > > Instead of: > > + elog(LOG, "%i parallel nodes planned (%i obtained all their workers, > %i obtained none), " > + "%i workers planned to be launched (%i workers launched)", > > what about something like: > > "launched %d parallel workers (planned: %)" > > For example, if I have 2 gather nodes and they each plan and launch > 2 workers, the log line should be as simple as > > "launched 4 parallel workers (planned: 4)" > > This behavior in which workers planned and launched are aggregated in the > log can be described in the documentation. "%i parallel nodes planned (%i obtained all their workers, %i obtained none)," I added this part during my first reorganization. I was trying to extract as much information as possible and thought that the special case where a parallel node was planned but no workers were obtained was the worst-case scenario, which might be interesting to log. If you think it doesn't bring much value, we can strip it. > 3/ Also, log_parallel_query_workers as the name of the GUC will make more sense > if we go logging parallel query only. I agree that log_parallel_query_workers would make more sense if we focus on logging parallel queries only. Since the maintenance-related logging was added later, I missed this point. Thank you for bringging this up. If agreeable, I will rename the GUC to log_parallel_workers as long as the argument regarding maintenance workers is unresolved. If we decide to strip them, I will revert it to log_parallel_query_workers. >> I don't think "failure" is a good name for the setting as it's >> a bit too harsh. What we really have is a "shortage" of >> workers. I agree that "failure" is too harsh. The term "shortage" better describes the situation. Note: I added Tomas Vondra to the recipients of the email since he advised me on this topic initially and might have an opinion on this. -- Benoit Lobréau Consultant http://dalibo.com