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 1tjDob-007RAp-6Y for pgsql-hackers@arkaria.postgresql.org; Sat, 15 Feb 2025 08:46:21 +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 1tjDoZ-0004q0-Cp for pgsql-hackers@arkaria.postgresql.org; Sat, 15 Feb 2025 08:46:19 +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 1tjDoZ-0004ps-2j for pgsql-hackers@lists.postgresql.org; Sat, 15 Feb 2025 08:46:19 +0000 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tjDoX-000vRT-1D for pgsql-hackers@lists.postgresql.org; Sat, 15 Feb 2025 08:46:18 +0000 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-43961c966a8so17561065e9.1 for ; Sat, 15 Feb 2025 00:46:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1739609176; x=1740213976; 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=5PCYTnU3kLEdVb2mmeV5In2fkV1i/b6IF90S8THwtuQ=; b=C6LJIpGGxDJbf+4f69BcPPaWgVY1mIw9c9FeOhQiMlgEs65GrW3eZO+2J8Pm9nX6DN apXvceyb0jNDJBLsDb12r6HDA7DBuykFBr9tPUhRud6aQibGRtHb7pF3BjP/usGlEXU+ PFu54OVlv5+jmXKfaFgcPce5wdB+63JNSIzdRuJOfDOvP41hPclOYNHT5hcXyI3wGJZI KmK9RNnzreWRMj3H4uJvdt9kyVf3xRB+ks/NAqj3pFpPfb9XGBj6H9HdsTgxtPRpoh2O +Cfb78LyaygRdP0vUT3uZANPAV3i3ApDtuO8Rloq3BRsBevXJwmXanWbUBqbs4MhJe+o 98nA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739609176; x=1740213976; 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=5PCYTnU3kLEdVb2mmeV5In2fkV1i/b6IF90S8THwtuQ=; b=paGA6EbWuTCxwgivR7772lWaDOYAHf/hrEKuUZaVGLhTLohR4QWhPilDQGQCgy54o0 +q+P9WyZ3tD8LI6J9weKKU+w5VWZEI0h4R4EsNyD/ykbER/fhdfRmaCvR/VUY83dz82O BPuuPIk7T2emacCzB8TZOFYcN95mpytauHGdyG0M+iDQWi547Cxf1TvI00psE3/BTllY EYK8urdSypqg6v8ULs7oVEU0bLfcasj/19BvUSptMI3u4u6XVgqka3763AsPubs/5dx/ 203mQAZvx/Ki6ru/Sozqj++1//II9EaDuG+u0xJ+5s2Rygg6hM1ZImK7hKbN1uDNBbbU +FPw== X-Gm-Message-State: AOJu0YzhUfUJkrc+fmSOeQRZ3svjCzaO6Wtdp5SCA9gbShHocR9Na656 kI8Do3cMLfWogy83AKF9ozmpLw1vKuEtqLbQnJW6tjIILe4vxfYp X-Gm-Gg: ASbGncuxW0epwh7HY2/VDBCRaqfa8L492fHOl+KZnuqz0p6uhwUdKZF3hSTbWnTDiYW /7UaaU1ZITDRjDBtOMHSqBaRgPgalwUrMLIinzL4cs97L9yetkjVIEqSysD6snZ/ciYBTVEJGpF T/ZJIX4ZGTHD41aAO1NTTLgJIjdnX6jjB66u6Qjv2QpowbzugS1X8JQnQKiTVLXZ5uFr59ysmbF NWMgf2xCH1sbNxi0wrzm9KYgnJ9A7kcpuGAn1w94zBlbmE1Q+2AN7qJUntB0FdlIP4+EY0iWjY+ SiHUWlltnLopNKHhhDU+VAaO X-Google-Smtp-Source: AGHT+IGBEBh+XLy+PyXWUDUe2iuPVxP5nT+hiww4oT1oMK7XVR34cDxdH634BK1BO5ioyiH8QlWQ9A== X-Received: by 2002:a05:600c:3110:b0:439:4b9a:a9fb with SMTP id 5b1f17b1804b1-4396e77948bmr29519795e9.30.1739609175633; Sat, 15 Feb 2025 00:46:15 -0800 (PST) Received: from [172.20.10.2] ([31.4.241.181]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38f258b432asm6565208f8f.6.2025.02.15.00.46.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 15 Feb 2025 00:46:14 -0800 (PST) Message-ID: Date: Sat, 15 Feb 2025 09:46:13 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: explain analyze rows=%.0f To: Robert Haas , Ilia Evdokimov Cc: pgsql-hackers@lists.postgresql.org, Tom Lane , Matheus Alcantara , Guillaume Lelarge , Daniel Gustafsson , Ibrar Ahmed , "Gregory Stark (as CFM)" , Amit Kapila , Justin Pryzby , Peter Geoghegan , vignesh C , "David G. Johnston" , Alena Rybakina 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> <3365160.1739385615@sss.pgh.pa.us> <0e4c813a-18eb-41e2-8edb-89b78d43c82d@gmail.com> Content-Language: en-US From: Andrei Lepikhov 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 13/2/2025 21:42, Robert Haas wrote: > On Thu, Feb 13, 2025 at 4:05 AM Ilia Evdokimov > wrote: >> 1. Documentation (v9-0001-Clarify-display-of-rows-as-decimal-fractions-DOC.patch) >> >> One thing that bothers me is that the documentation explains how to compute total time, but it does not clarify how to compute total rows. Maybe this was obvious to others before, but now that we are displaying rows as a fraction, we should explicitly document how to interpret it alongside total time. >> >> I believe it would be helpful to show a non-integer rows value in an example query. However, to achieve this, we need the index scan results to vary across iterations. One way to accomplish this is by using the condition t1.unique2 > t2.unique2. Additionally, I suggest making loops a round number (e.g., 100) for better readability, which can be achieved using t1.thousand < 10. The final query would look like this: >> >> EXPLAIN ANALYZE SELECT * >> FROM tenk1 t1, tenk2 t2 >> WHERE t1.thousand < 10 AND t1.unique2 > t2.unique2; >> >> I believe this is an ideal example for the documentation because it not only demonstrates fractional rows, but also keeps the execution plan nearly unchanged. While the estimated and actual average row counts become slightly rounded, I don't see another way to ensure different results for each index scan. > > Anyone else have an opinion on this? I see Ilia's point, but a > non-equality join is probably an atypical case. For me, it is ok: it demonstrates the feature and may legally happen. But this patch should be the second one, isn't it? > >> 2. Code and tests (v9-0002-Clarify-display-of-rows-as-decimal-fractions.patch) >> >> I left the code and tests unchanged since we agreed on a fixed format of two decimal places. > > This still has the HAS_DECIMAL() thing to which I objected. I don't understand why using math.h and the floor() routine is necessary. I personally prefer x%y!=0 expression. -- regards, Andrei Lepikhov