On 21st of February 2025, Robert Haas committed patch:
Allow EXPLAIN to indicate fractional rows. When nloops > 1, we now display two digits after the decimal point, rather than none. This is important because what we print is actually planstate->instrument->ntuples / nloops, and sometimes what you want to know is planstate->instrument->ntuples. You can estimate that by multiplying the displayed row count by the displayed nloops value, but the fact that the displayed value is rounded makes that inexact. It's still inexact even if we show these two extra decimal places, but less so. Perhaps we will agree on a way to further improve this output later, but for now this seems better than doing nothing. Author: Ibrar Ahmed <[email protected]> Author: Ilia Evdokimov <[email protected]> Reviewed-by: David G. Johnston <[email protected]> Reviewed-by: Amit Kapila <[email protected]> Reviewed-by: Vignesh C <[email protected]> Reviewed-by: Greg Stark <[email protected]> Reviewed-by: Naeem Akhter <[email protected]> Reviewed-by: Hamid Akhtar <[email protected]> Reviewed-by: Tom Lane <[email protected]> Reviewed-by: Andrei Lepikhov <[email protected]> Reviewed-by: Guillaume Lelarge <[email protected]> Reviewed-by: Matheus Alcantara <[email protected]> Reviewed-by: Alena Rybakina <[email protected]> Discussion: http://postgr.es/m/603c8f070905281830g2e5419c4xad2946d149e21f9d%40mail.gmail.com
and then, 6 days later he also committed:
EXPLAIN: Always use two fractional digits for row counts. Commit ddb17e387aa28d61521227377b00f997756b8a27 attempted to avoid confusing users by displaying digits after the decimal point only when nloops > 1, since it's impossible to have a fraction row count after a single iteration. However, this made the regression tests unstable since parallal queries will have nloops>1 for all nodes below the Gather or Gather Merge in normal cases, but if the workers don't start in time and the leader finishes all the work, they will suddenly have nloops==1, making it unpredictable whether the digits after the decimal point would be displayed or not. Although 44cbba9a7f51a3888d5087fc94b23614ba2b81f2 seemed to fix the immediate failures, it may still be the case that there are lower-probability failures elsewhere in the regression tests. Various fixes are possible here. For example, it has previously been proposed that we should try to display the digits after the decimal point only if rows/nloops is an integer, but currently rows is storead as a float so it's not theoretically an exact quantity -- precision could be lost in extreme cases. It has also been proposed that we should try to display the digits after the decimal point only if we're under some sort of construct that could potentially cause looping regardless of whether it actually does. While such ideas are not without merit, this patch adopts the much simpler solution of always display two decimal digits. If that approach stands up to scrutiny from the buildfarm and human users, it spares us the trouble of doing anything more complex; if not, we can reassess. This commit incidentally reverts 44cbba9a7f51a3888d5087fc94b23614ba2b81f2, which should no longer be needed. Author: Robert Haas <[email protected]> Author: Ilia Evdokimov <[email protected]> Discussion: http://postgr.es/m/CA+TgmoazzVHn8sFOMFAEwoqBTDxKT45D7mvkyeHgqtoD2cn58Q@mail.gmail.com
Continue reading Waiting for PostgreSQL 18 – Allow EXPLAIN to indicate fractional rows.