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 1tqIcQ-002clR-UX for pgsql-hackers@arkaria.postgresql.org; Thu, 06 Mar 2025 21:19:03 +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 1tqIcP-009ItQ-MR for pgsql-hackers@arkaria.postgresql.org; Thu, 06 Mar 2025 21:19:01 +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 1tqIcP-009ItI-6h for pgsql-hackers@lists.postgresql.org; Thu, 06 Mar 2025 21:19:01 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tqIcM-001NFe-1g for pgsql-hackers@lists.postgresql.org; Thu, 06 Mar 2025 21:19:00 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mx2023; t=1741295934; bh=TQBt5AnSgxBUNHbdQrC9cYa/PKA7um15TayoHfuazAk=; h=Message-ID:Date:User-Agent:Subject:To:Cc:References:From: In-Reply-To:From; b=AFQWDGu3hRdpo7mbnbW78rijpJeZWkog9bkQ59Y8ooqkqUhxT6p/T21vWcWyjVIe8 rkwcb+X95ezOhN7+pE4tiWZkk9VP82kgWUApxgMV4gyJQ3yOwnZzZDiXYEtOOZ0ov7 JoSxhnWepGNXxzoHzgYH0qS6r+aSP4JZ+YW6C4UoyggZ6/xQ9ttX2M/7Nn0p8TCTDQ a17b3i7grv3dOHy7L9XW+WkIXlffgVxp9Hox4Uwz0eQYgliaGgR8U5w3M7O1JLo9c/ Duu2jgdQTIEQ/8p7wB1Cu4mK2eUMHXTUCP26D90kifYcT2+Qmc+IjLeSZMvbAclfAS gCdLgE2ZKzadQ== Received: from [172.20.10.4] (unknown [89.113.152.110]) (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 64ED060843; Fri, 7 Mar 2025 00:18:54 +0300 (MSK) Message-ID: <432c75b0-be5f-4836-b46b-98c505eaad28@postgrespro.ru> Date: Fri, 7 Mar 2025 00:18:52 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: explain analyze rows=%.0f To: Robert Haas , Matthias van de Meent Cc: Ilia Evdokimov , Tom Lane , Andrei Lepikhov , pgsql-hackers@lists.postgresql.org, Guillaume Lelarge , Matheus Alcantara References: <73e2440e-7d8b-4860-974d-931a93326d95@gmail.com> <3737950.1740182671@sss.pgh.pa.us> <3816053.1740190267@sss.pgh.pa.us> <40663fc5-edac-4b45-a2aa-a76976700ed9@tantorlabs.com> Content-Language: en-US From: Alena Rybakina In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-KSMG-AntiPhishing: NotDetected 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/03/06 10:27:00 #27639335 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 On 06.03.2025 17:13, Robert Haas wrote: > On Thu, Mar 6, 2025 at 8:30 AM Matthias van de Meent > wrote: >> On Thu, 6 Mar 2025 at 14:18, Alena Rybakina wrote: >>> Hi! I got a query plan with a strange number of rows. Could you please >>> help me understand it? >>> >>> To be honest I can't understand why 0.50 number of rows here? >> Because the scan matched only ~(500 rows over 999 iterations = 500/999 >> ~=) 0.50 rows for every loop, on average, for these plan nodes: > This is a good and correct explanation, but I'm VERY curious to hear > more from Alena. Like, Tom expressed the concern before we did this > that the fractional digits would confuse people, and the fact that > someone who is a regular participant on this mailing list was one of > the people confused gives credence to that concern. But I want to know > what exactly Alena found (or finds) confusing here. The Nested Loop > executes 999 times, so perhaps Alena thought that 0.50 was the TOTAL > number of rows across ALL of those executions rather than the AVERAGE > number of rows per execution? Because then 0.50 would indeed be a very > surprising result. Or maybe she just didn't realize that part of the > plan executed 999 times? Or something else? > > Alena, if you're willing, please elaborate on what you think is confusing here! To be honest, I initially took it as the total number of tuples and couldn't figure out for myself how to interpret the result - 0 tuples or 1 tuple in the end. Maybe it wasn't quite correct to perceive it that way, but Matthias's explanation helped me figure out the reason why such a strange result was obtained, although it's not usual to see it. -- Regards, Alena Rybakina Postgres Professional