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 1thwAT-008oy3-Ha for pgsql-hackers@arkaria.postgresql.org; Tue, 11 Feb 2025 19:43:38 +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 1thwAS-00Essl-7r for pgsql-hackers@arkaria.postgresql.org; Tue, 11 Feb 2025 19:43:36 +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 1thwAR-00Essc-PV for pgsql-hackers@lists.postgresql.org; Tue, 11 Feb 2025 19:43:35 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1thwAO-000J80-2Z for pgsql-hackers@lists.postgresql.org; Tue, 11 Feb 2025 19:43:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mx2023; t=1739303012; bh=11kcHmIj9hfLjQGQsr/Y729lohubkfuU0/Qxy4yG7Kk=; h=Message-ID:Date:User-Agent:Subject:To:Cc:References:From: In-Reply-To:From; b=4fw+rEuuiiu+WMRsYPB3pQdbjBfQ3mN5plHOBmtC7HlJrR/h1Jrnir3jw/F4Aj/Z5 Z8RiJa4jJN6FC1Dg5t7VaFZ9iUnSkG2F4JdzWfeb/a+BCSMR3Z2ehxoDD5366UZiN/ Upet0fWFDqpSAiVI41Cd28mCzUmq40Djftm8mCU6Hmtzut1AVsvKmliox/W6FHNHtn ua14aa9u2AtC75IfIlsUNxWaPSj28vkKLbDcNXWZzN6b2N9a6iHAUPr5B5S8rKVyMG gjuiUYb1Ec33CLCpBuTNk6SbZpyORsecYEiMmekX0xPxm89H0/BOx4F0MsmVKrCNiD y8QmL5vcp6Ajg== Received: from [172.20.10.4] (unknown [89.113.158.232]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: a.rybakina@postgrespro.ru) by mail.postgrespro.ru (Postfix/587) with ESMTPSA id 6A1225FFE1; Tue, 11 Feb 2025 22:43:31 +0300 (MSK) Message-ID: <4f7096bc-6b58-492b-8fe9-be54cebfb905@postgrespro.ru> Date: Tue, 11 Feb 2025 22:43:30 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: explain analyze rows=%.0f To: Ilia Evdokimov Cc: Robert Haas , Andrei Lepikhov , Matheus Alcantara , Guillaume Lelarge , Daniel Gustafsson , Ibrar Ahmed , "Gregory Stark (as CFM)" , Tom Lane , Amit Kapila , Justin Pryzby , Peter Geoghegan , vignesh C , "David G. Johnston" , pgsql-hackers@lists.postgresql.org References: <55695d15-c738-4401-8883-58bc855c9b03@tantorlabs.com> <58bb3a5b-c92a-408c-b02a-f47aedc1c0e2@tantorlabs.com> <70bc1af0-6910-4f71-84ba-fa02095fe9ba@tantorlabs.com> <9d06ca26-481a-4bab-a4f9-92e94385c11c@tantorlabs.com> Content-Language: en-US From: Alena Rybakina In-Reply-To: <9d06ca26-481a-4bab-a4f9-92e94385c11c@tantorlabs.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-KSMG-AntiPhishing: NotDetected, bases: 2025/02/11 19:02:00 X-KSMG-AntiSpam-Interceptor-Info: not scanned X-KSMG-AntiSpam-Status: not scanned, disabled by settings X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 2.1.0.7854, bases: 2025/02/11 16:28:00 #27149855 X-KSMG-AntiVirus-Status: NotDetected, skipped X-KSMG-LinksScanning: not scanned, disabled by settings X-KSMG-Message-Action: skipped X-KSMG-Rule-ID: 1 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi! Thank you for your valuable work on this! On 11.02.2025 22:18, Ilia Evdokimov wrote: > > On 11.02.2025 20:41, Robert Haas wrote: >> On Tue, Feb 11, 2025 at 12:14 PM Andrei Lepikhov >> wrote: >>> I support the idea in general, but I believe it should be expanded to >>> cover all cases of parameterised plan nodes. Each rescan iteration may >>> produce a different number of tuples, and rounding can obscure >>> important >>> data. >>> >>> For example, consider five loops of a scan node: the first loop returns >>> nine tuples, and each other - zero tuples. When we calculate the >>> average, 9 divided by 5 equals 1.8. This results in an explanation that >>> indicates "rows = 1," masking almost 40% of the data. >>> >>> Now, if we apply the same two loops but have a total of 900,000 tuples, >>> then 400,000 masked tuples represent a significant portion of the data. >>> >>> Moreover, switching to a floating-point type for row explanations in >>> each parameterised node would provide a more comprehensive view and add >>> valuable information about the parameterisation of the node, which may >>> not be immediately apparent. >> I agree strongly with all of this. I believe we should just implement >> what was agreed here: >> >> https://www.postgresql.org/message-id/21013.1243618236%40sss.pgh.pa.us >> >> Let's just display 2 fractional digits when nloops>1, else 0, and >> call it good. >> > > Thank you for your review! > > With such example, it's hard to disagree with it. This would really > add valuable information. Taking all opinions into account, I have > updated the patch v8. I have also included a check for the case where > there are only zeros after the decimal point. We do not want to > clutter the rows with unnecessary zeros. > I looked at the patch and agree with them. I would suggest adding a description of how this can help in analyzing the query plans - I think there is a lack of a description of the reason why this is done in the commit message. I would also add the same to the documentation with an example. -- Regards, Alena Rybakina Postgres Professional