mirror of
https://github.com/postgres/postgres.git
synced 2025-06-11 20:28:21 +03:00
EXPLAIN: Always use two fractional digits for row counts.
Commitddb17e387a
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. Although44cbba9a7f
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 reverts44cbba9a7f
, which should no longer be needed. Author: Robert Haas <robertmhaas@gmail.com> Author: Ilia Evdokimov <ilya.evdokimov@tantorlabs.com> Discussion: http://postgr.es/m/CA+TgmoazzVHn8sFOMFAEwoqBTDxKT45D7mvkyeHgqtoD2cn58Q@mail.gmail.com
This commit is contained in:
@ -11670,15 +11670,15 @@ SELECT * FROM local_tbl, async_pt WHERE local_tbl.a = async_pt.a AND local_tbl.c
|
||||
|
||||
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF, BUFFERS OFF)
|
||||
SELECT * FROM local_tbl, async_pt WHERE local_tbl.a = async_pt.a AND local_tbl.c = 'bar';
|
||||
QUERY PLAN
|
||||
-------------------------------------------------------------------------------
|
||||
Nested Loop (actual rows=1 loops=1)
|
||||
-> Seq Scan on local_tbl (actual rows=1 loops=1)
|
||||
QUERY PLAN
|
||||
----------------------------------------------------------------------------------
|
||||
Nested Loop (actual rows=1.00 loops=1)
|
||||
-> Seq Scan on local_tbl (actual rows=1.00 loops=1)
|
||||
Filter: (c = 'bar'::text)
|
||||
Rows Removed by Filter: 1
|
||||
-> Append (actual rows=1 loops=1)
|
||||
-> Append (actual rows=1.00 loops=1)
|
||||
-> Async Foreign Scan on async_p1 async_pt_1 (never executed)
|
||||
-> Async Foreign Scan on async_p2 async_pt_2 (actual rows=1 loops=1)
|
||||
-> Async Foreign Scan on async_p2 async_pt_2 (actual rows=1.00 loops=1)
|
||||
-> Seq Scan on async_p3 async_pt_3 (never executed)
|
||||
Filter: (a = local_tbl.a)
|
||||
(9 rows)
|
||||
@ -11916,20 +11916,20 @@ SELECT * FROM local_tbl t1 LEFT JOIN (SELECT *, (SELECT count(*) FROM async_pt W
|
||||
|
||||
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF, BUFFERS OFF)
|
||||
SELECT * FROM local_tbl t1 LEFT JOIN (SELECT *, (SELECT count(*) FROM async_pt WHERE a < 3000) FROM async_pt WHERE a < 3000) t2 ON t1.a = t2.a;
|
||||
QUERY PLAN
|
||||
-----------------------------------------------------------------------------------------
|
||||
Nested Loop Left Join (actual rows=1 loops=1)
|
||||
QUERY PLAN
|
||||
--------------------------------------------------------------------------------------------
|
||||
Nested Loop Left Join (actual rows=1.00 loops=1)
|
||||
Join Filter: (t1.a = async_pt.a)
|
||||
Rows Removed by Join Filter: 399
|
||||
InitPlan 1
|
||||
-> Aggregate (actual rows=1 loops=1)
|
||||
-> Append (actual rows=400 loops=1)
|
||||
-> Async Foreign Scan on async_p1 async_pt_4 (actual rows=200 loops=1)
|
||||
-> Async Foreign Scan on async_p2 async_pt_5 (actual rows=200 loops=1)
|
||||
-> Seq Scan on local_tbl t1 (actual rows=1 loops=1)
|
||||
-> Append (actual rows=400 loops=1)
|
||||
-> Async Foreign Scan on async_p1 async_pt_1 (actual rows=200 loops=1)
|
||||
-> Async Foreign Scan on async_p2 async_pt_2 (actual rows=200 loops=1)
|
||||
-> Aggregate (actual rows=1.00 loops=1)
|
||||
-> Append (actual rows=400.00 loops=1)
|
||||
-> Async Foreign Scan on async_p1 async_pt_4 (actual rows=200.00 loops=1)
|
||||
-> Async Foreign Scan on async_p2 async_pt_5 (actual rows=200.00 loops=1)
|
||||
-> Seq Scan on local_tbl t1 (actual rows=1.00 loops=1)
|
||||
-> Append (actual rows=400.00 loops=1)
|
||||
-> Async Foreign Scan on async_p1 async_pt_1 (actual rows=200.00 loops=1)
|
||||
-> Async Foreign Scan on async_p2 async_pt_2 (actual rows=200.00 loops=1)
|
||||
(12 rows)
|
||||
|
||||
SELECT * FROM local_tbl t1 LEFT JOIN (SELECT *, (SELECT count(*) FROM async_pt WHERE a < 3000) FROM async_pt WHERE a < 3000) t2 ON t1.a = t2.a;
|
||||
@ -11960,15 +11960,15 @@ SELECT * FROM async_pt t1 WHERE t1.b === 505 LIMIT 1;
|
||||
|
||||
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF, BUFFERS OFF)
|
||||
SELECT * FROM async_pt t1 WHERE t1.b === 505 LIMIT 1;
|
||||
QUERY PLAN
|
||||
-------------------------------------------------------------------------
|
||||
Limit (actual rows=1 loops=1)
|
||||
-> Append (actual rows=1 loops=1)
|
||||
-> Async Foreign Scan on async_p1 t1_1 (actual rows=0 loops=1)
|
||||
QUERY PLAN
|
||||
----------------------------------------------------------------------------
|
||||
Limit (actual rows=1.00 loops=1)
|
||||
-> Append (actual rows=1.00 loops=1)
|
||||
-> Async Foreign Scan on async_p1 t1_1 (actual rows=0.00 loops=1)
|
||||
Filter: (b === 505)
|
||||
-> Async Foreign Scan on async_p2 t1_2 (actual rows=0 loops=1)
|
||||
-> Async Foreign Scan on async_p2 t1_2 (actual rows=0.00 loops=1)
|
||||
Filter: (b === 505)
|
||||
-> Seq Scan on async_p3 t1_3 (actual rows=1 loops=1)
|
||||
-> Seq Scan on async_p3 t1_3 (actual rows=1.00 loops=1)
|
||||
Filter: (b === 505)
|
||||
Rows Removed by Filter: 101
|
||||
(9 rows)
|
||||
@ -12120,12 +12120,12 @@ DELETE FROM async_p2;
|
||||
DELETE FROM async_p3;
|
||||
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF, BUFFERS OFF)
|
||||
SELECT * FROM async_pt;
|
||||
QUERY PLAN
|
||||
-------------------------------------------------------------------------
|
||||
Append (actual rows=0 loops=1)
|
||||
-> Async Foreign Scan on async_p1 async_pt_1 (actual rows=0 loops=1)
|
||||
-> Async Foreign Scan on async_p2 async_pt_2 (actual rows=0 loops=1)
|
||||
-> Seq Scan on async_p3 async_pt_3 (actual rows=0 loops=1)
|
||||
QUERY PLAN
|
||||
----------------------------------------------------------------------------
|
||||
Append (actual rows=0.00 loops=1)
|
||||
-> Async Foreign Scan on async_p1 async_pt_1 (actual rows=0.00 loops=1)
|
||||
-> Async Foreign Scan on async_p2 async_pt_2 (actual rows=0.00 loops=1)
|
||||
-> Seq Scan on async_p3 async_pt_3 (actual rows=0.00 loops=1)
|
||||
(4 rows)
|
||||
|
||||
-- Clean up
|
||||
|
Reference in New Issue
Block a user