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 1ti8W2-00BqLe-FL for pgsql-hackers@arkaria.postgresql.org; Wed, 12 Feb 2025 08:54:42 +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 1ti8W0-007OS3-ID for pgsql-hackers@arkaria.postgresql.org; Wed, 12 Feb 2025 08:54:41 +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 1ti8W0-007ORg-83 for pgsql-hackers@lists.postgresql.org; Wed, 12 Feb 2025 08:54:40 +0000 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1ti8Vy-000Ngb-35 for pgsql-hackers@lists.postgresql.org; Wed, 12 Feb 2025 08:54:40 +0000 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-38dcb7122c1so4292564f8f.2 for ; Wed, 12 Feb 2025 00:54:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1739350477; x=1739955277; darn=lists.postgresql.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=H9MX0Uka0UxUwHvvFtxEk2nOcui2UpCL/X0tb3GWIeI=; b=EOhzrshNks2A7dfF3UcIHpT/hIW229wv5L0oG7Pi4URPIldUQGBwyjKujJ0CkhLDDo MCmBSInqeHzJUKGgA9gwB54+Boa2JsCI8HsnEtZPZYseX/HkNWBgHIlxW4NkanFyU7ex U5wVt8NWCvMbRx1+BFIwXLMY+LjLy8ku22XZ9MlrmXHlgDosBI5xZB+MT8d3aRIDIp7J gj9kGkK0QmHUbakvZbWkqyc8A+8cizHqqyqNH6BhgavY9j3kPYiWt7cvb2z7AG6FesiY iUjdJB5ILQAzQOW78rx3+LYVOSg+FPirvoButAtab5Z2a98V8yloggYEOOHy0t0J1jeo Fdvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739350477; x=1739955277; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=H9MX0Uka0UxUwHvvFtxEk2nOcui2UpCL/X0tb3GWIeI=; b=klXN4TnHEXRKMXtj9PW4/4Hggpefa4TXGvSMxisLzcvy8GcZhoCd30C1lqOm1GLBW1 2fgcFFdfgSClt7wYZMaZ/MIMc7BRxBPOlsKxcSIfr6ayF9jPf8BYVZz3Wk+h8uaN6XPr sdyG6Nhs7AmZ+AdS6w2viFJELhkQjCMa0IpjzRFZxfqzwx36mqgYKa0k15MYOd7mr/Js hqpDGevUu0QSK27h1gr6LV+HzN1jAkERUMDX6Bz5QbDlh/U7pWj0RkqH4O7ZFYH4G5xm sZT0UBf6iLvgqfYoynJkgDL5sqd45E1/zt+NryaR7kIOnr5TH0xpLlMalVUtGYUDhDf1 9yfQ== X-Forwarded-Encrypted: i=1; AJvYcCVNZbCCXEuiaz7MDRXe0AwT8ARRMSaAwcVlC4j1tVoX9gBE06kls6z766O17/B3+m01+KrMJ9yI5249dBFB@lists.postgresql.org X-Gm-Message-State: AOJu0YzvO7iAVexHkpzbE8Qplh7UifcFC8PIqCYuE6tnhf62m94+dD58 s2Atd+uD8OyC43XWY0PbBgwOfX62Y39kMPZ3cDt4wQJyT8KDP7WX X-Gm-Gg: ASbGncuwUDsfN5Gkmp15U6mcPMfkOb5lh/ieG8HRfR+kgATYOxs1jlk4U7VRq16fgPA uedyMTquDpIoN+FKu6uY/PcfEgBi9b8N+dLSh/GoXsTYVUjaXwL/DAFD861aBTo+/Z/8AF+lVVz AolF1NhIq8WjhKAYVR1gf+TJkMumJLWQvJWk6pmOlCUWd74Va4t0lFox5xnCO09//lsKoyXcrNy UqqfyMqbylXWhPsrTWA+DEE2fyekScMRfMcqkxabfuYww7kFTt3bU8KSHY2dLSXtR9HQza1xYxR vzvjHRexHEBZ12NUZo4vXxY= X-Google-Smtp-Source: AGHT+IHQL4b3Gl7AisgeETh0PMctTrg+xGlyl6okC19x/pnqlzdWkN4PGXPihpXVsc7irr9W1l/ESw== X-Received: by 2002:a5d:5f8c:0:b0:38e:6cd0:f973 with SMTP id ffacd0b85a97d-38e6cd1122dmr1013707f8f.21.1739350475647; Wed, 12 Feb 2025 00:54:35 -0800 (PST) Received: from [172.20.10.2] ([31.4.241.82]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4395a06d22csm13334715e9.22.2025.02.12.00.54.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 12 Feb 2025 00:54:35 -0800 (PST) Message-ID: Date: Wed, 12 Feb 2025 09:54:33 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: explain analyze rows=%.0f To: Tom Lane , Robert Haas Cc: Ilia Evdokimov , Matheus Alcantara , Guillaume Lelarge , Daniel Gustafsson , Ibrar Ahmed , "Gregory Stark (as CFM)" , 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> <3212947.1739306803@sss.pgh.pa.us> Content-Language: en-US From: Andrei Lepikhov In-Reply-To: <3212947.1739306803@sss.pgh.pa.us> 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 12/2/2025 03:46, Tom Lane wrote: > Robert Haas writes: >> 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. > >> 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. > > Note that that formulation has nothing especially to do with > parameterized plan nodes. Any nestloop inner side would end up > getting shown with fractional rowcounts. Maybe that's fine. I partly agree with this approach. Playing around a bit, I couldn't invent a case where we have different numbers of tuples without parameters. But I can imagine it is possible or may be possible in future. So, it is not necessary to tangle fractional output with a parameterised node. I'm unsure about the inner subtree of a JOIN - subplan may refer to the upper query and process a different number of tuples for every evaluation without any JOIN operator. May we agree on a more general formula to print at least two meaningful digits if we have a fractional part? Examples: - actual rows = 2, nloops = 2 -> rows = 1 - actual rows = 9, nloops = 5 -> rows = 1.8 - actual rows = 101, nloops = 100 -> rows = 1.0 - actual rows = 99, nloops = 1000000 -> rows = 0.000099 It may guarantee that an EXPLAIN exposes most of the data passed the node, enough to tangle it with actual timing and tuples at the upper levels of the query. > > I suggest that when thinking about what to change here, > you start by considering how you'd adjust the docs at > https://www.postgresql.org/docs/devel/using-explain.html > to explain the new behavior. If you can't explain it > clearly for users, then maybe it's not such a great idea. Agree -- regards, Andrei Lepikhov