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 1tkUcZ-004V0X-7k for pgsql-hackers@arkaria.postgresql.org; Tue, 18 Feb 2025 20:55:11 +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 1tkUcX-000n5V-K2 for pgsql-hackers@arkaria.postgresql.org; Tue, 18 Feb 2025 20:55:09 +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 1tkUcX-000n51-AA for pgsql-hackers@lists.postgresql.org; Tue, 18 Feb 2025 20:55:09 +0000 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tkUcV-001aQ4-2U for pgsql-hackers@lists.postgresql.org; Tue, 18 Feb 2025 20:55:08 +0000 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-43971025798so21186325e9.1 for ; Tue, 18 Feb 2025 12:55:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1739912104; x=1740516904; 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=2JpQCK7Dzz+bAYfqB/KFQUVvqnyEdJzFveITLUz5wLk=; b=fcuVM86x/tkgtb3XG1NJt0zeIiuUPv5Mo+ui/OIQQOoJygH76VlOfSsmp50pAABHNr 4vy+ahbaoCmz3xVbBlYGsQyMnM09eovyvfvhogUWqnjK8T4LDlqHiTdIieGcMx8EgJjX ZmkyMNeq+wIRcN0Ua3j1BfgUusuNdWAddBljFqB/cxkBXUBjqDumZRqIq/j9Lun8rfHS MEb6vLuycprZuOrMqcLWd6Wt8Yzj+x4UHIMC7Jk++FrNmBw3CXGuNN2J0/QYXAdBnZY3 2pM/LAqYj0xArn13cI0ATWJdqaoYeJwvHH1KZS207+HyZZkq8y23xJMJfeiiwpV8GOAM XT7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739912104; x=1740516904; 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=2JpQCK7Dzz+bAYfqB/KFQUVvqnyEdJzFveITLUz5wLk=; b=oey8hEwOjCiV8LfNgYxa4tPKqz67O3i+uw96vP2VjSYbKIT1z0bYVrSuZKp6qcmmGT IemrfsmFTsst47SJ9PSuIPFlKcZ84Gu9JC0PLLcScohSfPCPLqc8cd7kXKjXyR6emSRp RAO2kxrHrReoSb5CG+14zQE4MTFLpHWgJiSC20kgQBHOe4BouM6qJQgN4HrUr3zNSQvW D5nSC8mehzD1OkXNKb1mK366+l98S4i8BNDgMD/Fj7oawRKSuvEIqZnJsIQT5npiAzbh Mp43zsP3DhwwblIVi/rELZ2yRDwCIycvrldDL6bWnFZlzBHVexz9mF1MoeRAcnktaNup 2kjw== X-Gm-Message-State: AOJu0Yyn25n6jeUAR/JvdguqETnINI4X3gIw+ygYZXUlWcd28TUeCbkC amhyotgzJkvp9f9GB1sBz0i+m/8D0O8a3+ziPpR+lRnIowrm5oId X-Gm-Gg: ASbGncsyYzocAnk4eHIcVNU5V2RbDDGSmdlyahnET3w5M1gJcq5Igw+7f4y0unxk+86 6ipW3PNqPCQEtlGhMtKn0DYrkgs/9L3nNpyJz+EIadbYz0rnQC+XfqExi0CpX13GtlqnLUdTTx4 lnzt8bLZfInPWxpXr7rJ1iycMZEaOPDnxbiq+7sDIJrRGJElIMdDmm6BOA96n7MbNSMD8Dmzn3d H2pLalIg4bCPnXN/oyeoxt35IjLnmhJeHQ86oEvSaVGO+iGqQ3Og6KG7qstXFakM9isYz0ZiesE 76ZItXuHdPygyPHpItjXPwKnKiUZRufdX6aOtkzBxyrrVHJKjuBcvub75ogTL6xPSThVGdsQUwr g0jjmjpU= X-Google-Smtp-Source: AGHT+IHo+IXZFjJEVQNysfIe4RYUzCfu/fRmxvCHBAXADXboBcC/ZdaJpKZGQsNVsP7/hUSmmg1LIQ== X-Received: by 2002:a05:600c:1d1d:b0:439:99ab:6178 with SMTP id 5b1f17b1804b1-43999ab62d0mr12748335e9.6.1739912103940; Tue, 18 Feb 2025 12:55:03 -0800 (PST) Received: from ?IPV6:2a0c:5a81:b50d:5900:452a:6d96:5c1:68d8? ([2a0c:5a81:b50d:5900:452a:6d96:5c1:68d8]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38f259f8602sm16382330f8f.94.2025.02.18.12.55.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 18 Feb 2025 12:55:03 -0800 (PST) Message-ID: <73e2440e-7d8b-4860-974d-931a93326d95@gmail.com> Date: Tue, 18 Feb 2025 21:55:01 +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: <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> <01ec86c1-e04b-4cbe-b641-22cae8b87604@tantorlabs.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 17/2/2025 15:19, Robert Haas wrote: > On Mon, Feb 17, 2025 at 3:08 AM Ilia Evdokimov > if (nloops > 1) > > Instead of: > > if (nloops > 1 && rows_is_fractonal) > > I don't think it's really safe to just cast a double back to int64. In > practice, the number of tuples should never be large enough to > overflow int64, but if it did, this result would be nonsense. Also, if > the double ever lost precision, the result would be nonsense. If we > want to have an exact count of tuples, we ought to change ntuples and > ntuples2 to be uint64. But I don't think we should do that in this > patch, because that adds a whole bunch of new problems to worry about > and might cause us to get nothing committed. Instead, I think we > should just always show two decimal digits if there's more than one > loop. > > That's simpler than what the patch currently does and avoids this > problem. Perhaps it's objectionable for some other reason, but if so, > can somebody please spell out what that reason is so we can talk about > it? I can understand two decimal places. You might be concerned about potential issues with some codes that parse PostgreSQL explains. However, I believe it would be beneficial to display fractional parts only when iterations yield different numbers of tuples. Given that I often work with enormous explains, I think this approach would enhance the readability and comprehension of the output. Frequently, I may see only part of the EXPLAIN on the screen. A floating-point row number format may immediately give an idea about parameterisation (or another reason for the subtree's variability) and trace it down to the source. -- regards, Andrei Lepikhov