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 1ti9hf-00C6f4-K0 for pgsql-hackers@arkaria.postgresql.org; Wed, 12 Feb 2025 10:10:47 +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 1ti9hd-008A5I-5R for pgsql-hackers@arkaria.postgresql.org; Wed, 12 Feb 2025 10:10:45 +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 1ti9hc-008A4P-Qv for pgsql-hackers@lists.postgresql.org; Wed, 12 Feb 2025 10:10:45 +0000 Received: from forward502a.mail.yandex.net ([178.154.239.82]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1ti9ha-000QLa-1z for pgsql-hackers@lists.postgresql.org; Wed, 12 Feb 2025 10:10:44 +0000 Received: from mail-nwsmtp-smtp-production-main-22.iva.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-22.iva.yp-c.yandex.net [IPv6:2a02:6b8:c0c:2e21:0:640:e279:0]) by forward502a.mail.yandex.net (Yandex) with ESMTPS id F409761341; Wed, 12 Feb 2025 13:10:40 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-22.iva.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id YAMA8P1OruQ0-Ex9z6iX1; Wed, 12 Feb 2025 13:10:40 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tantorlabs.com; s=mail; t=1739355040; bh=vU6Q3lIxxMqe2gnBZpI9tETsQxSWrmsi7hM/wEUwMCY=; h=From:In-Reply-To:Cc:Date:References:To:Subject:Message-ID; b=G03rAM0W1Ng23iu7S9OiMx3ZXnFM3svlPpGCBi1eMM3fLD5X7EyBuZVPHkh63shlx m7SFY5Qw4KMK7TG7zyqQnKPCEgIz2DagyVUajhzGI9SWN9QE1nMePcTuT41urPU+hC RNa7zHUSkAgvgzsp2FqB0xotghRBKG+kDtC1fLP0= Authentication-Results: mail-nwsmtp-smtp-production-main-22.iva.yp-c.yandex.net; dkim=pass header.i=@tantorlabs.com Message-ID: Date: Wed, 12 Feb 2025 13:10:34 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: explain analyze rows=%.0f To: Andrei Lepikhov , Tom Lane , Robert Haas Cc: 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: Ilia Evdokimov 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 On 12.02.2025 11:54, Andrei Lepikhov wrote: > 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 think the idea of keeping two significant digits after the decimal point is quite reasonable. The thing is, rows=0.000001 or something similar can only occur when loops is quite large. If we show the order of magnitude in rows, it will be easier for the user to estimate the order of total rows. For example, if we see this: rows=0.000056 loops=4718040 the user can quickler approximate the order of total rows for analyzing the upper levels of the query. However, keep in mind that I am against using the E notation, as many users have mentioned that they are not mathematicians and are not familiar with the concept of "E". > >> >> 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 > So do I. Firstly, I'll think how to explain it. -- Best regards, Ilia Evdokimov, Tantor Labs LLC.