1
0
mirror of https://github.com/postgres/postgres.git synced 2025-04-24 10:47:04 +03:00

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 <ibrar.ahmad@gmail.com>
Author: Ilia Evdokimov <ilya.evdokimov@tantorlabs.com>
Reviewed-by: David G. Johnston <david.g.johnston@gmail.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Reviewed-by: Vignesh C <vignesh21@gmail.com>
Reviewed-by: Greg Stark <stark@mit.edu>
Reviewed-by: Naeem Akhter <akhternaeem@gmail.com>
Reviewed-by: Hamid Akhtar <hamid.akhtar@percona.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Andrei Lepikhov <a.lepikhov@postgrespro.ru>
Reviewed-by: Guillaume Lelarge <guillaume@lelarge.info>
Reviewed-by: Matheus Alcantara <matheusssilv97@gmail.com>
Reviewed-by: Alena Rybakina <a.rybakina@postgrespro.ru>
Discussion: http://postgr.es/m/603c8f070905281830g2e5419c4xad2946d149e21f9d%40mail.gmail.com
This commit is contained in:
Robert Haas 2025-02-21 16:10:44 -05:00
parent 78d3f48895
commit ddb17e387a
6 changed files with 113 additions and 95 deletions

View File

@ -1993,14 +1993,15 @@ ExplainNode(PlanState *planstate, List *ancestors,
if (es->format == EXPLAIN_FORMAT_TEXT) if (es->format == EXPLAIN_FORMAT_TEXT)
{ {
appendStringInfo(es->str, " (actual ");
if (es->timing) if (es->timing)
appendStringInfo(es->str, appendStringInfo(es->str, "time=%.3f..%.3f ", startup_ms, total_ms);
" (actual time=%.3f..%.3f rows=%.0f loops=%.0f)",
startup_ms, total_ms, rows, nloops); if (nloops > 1)
appendStringInfo(es->str, "rows=%.2f loops=%.0f)", rows, nloops);
else else
appendStringInfo(es->str, appendStringInfo(es->str, "rows=%.0f loops=%.0f)", rows, nloops);
" (actual rows=%.0f loops=%.0f)",
rows, nloops);
} }
else else
{ {
@ -2011,10 +2012,18 @@ ExplainNode(PlanState *planstate, List *ancestors,
ExplainPropertyFloat("Actual Total Time", "ms", total_ms, ExplainPropertyFloat("Actual Total Time", "ms", total_ms,
3, es); 3, es);
} }
if (nloops > 1)
{
ExplainPropertyFloat("Actual Rows", NULL, rows, 2, es);
ExplainPropertyFloat("Actual Loops", NULL, nloops, 0, es);
}
else
{
ExplainPropertyFloat("Actual Rows", NULL, rows, 0, es); ExplainPropertyFloat("Actual Rows", NULL, rows, 0, es);
ExplainPropertyFloat("Actual Loops", NULL, nloops, 0, es); ExplainPropertyFloat("Actual Loops", NULL, nloops, 0, es);
} }
} }
}
else if (es->analyze) else if (es->analyze)
{ {
if (es->format == EXPLAIN_FORMAT_TEXT) if (es->format == EXPLAIN_FORMAT_TEXT)
@ -2064,14 +2073,14 @@ ExplainNode(PlanState *planstate, List *ancestors,
if (es->format == EXPLAIN_FORMAT_TEXT) if (es->format == EXPLAIN_FORMAT_TEXT)
{ {
ExplainIndentText(es); ExplainIndentText(es);
appendStringInfo(es->str, "actual ");
if (es->timing) if (es->timing)
appendStringInfo(es->str, appendStringInfo(es->str, "time=%.3f..%.3f", startup_ms, total_ms);
"actual time=%.3f..%.3f rows=%.0f loops=%.0f\n",
startup_ms, total_ms, rows, nloops); if (nloops > 1)
appendStringInfo(es->str, "rows=%.2f loops=%.0f\n", rows, nloops);
else else
appendStringInfo(es->str, appendStringInfo(es->str, "rows=%.0f loops=%.0f\n", rows, nloops);
"actual rows=%.0f loops=%.0f\n",
rows, nloops);
} }
else else
{ {
@ -2082,9 +2091,18 @@ ExplainNode(PlanState *planstate, List *ancestors,
ExplainPropertyFloat("Actual Total Time", "ms", ExplainPropertyFloat("Actual Total Time", "ms",
total_ms, 3, es); total_ms, 3, es);
} }
if (nloops > 1)
{
ExplainPropertyFloat("Actual Rows", NULL, rows, 2, es);
ExplainPropertyFloat("Actual Loops", NULL, nloops, 0, es);
}
else
{
ExplainPropertyFloat("Actual Rows", NULL, rows, 0, es); ExplainPropertyFloat("Actual Rows", NULL, rows, 0, es);
ExplainPropertyFloat("Actual Loops", NULL, nloops, 0, es); ExplainPropertyFloat("Actual Loops", NULL, nloops, 0, es);
} }
}
ExplainCloseWorker(n, es); ExplainCloseWorker(n, es);
} }

View File

@ -528,7 +528,7 @@ select jsonb_pretty(
"Plan Rows": 0, + "Plan Rows": 0, +
"Plan Width": 0, + "Plan Width": 0, +
"Total Cost": 0.0, + "Total Cost": 0.0, +
"Actual Rows": 0, + "Actual Rows": 0.0, +
"Actual Loops": 0, + "Actual Loops": 0, +
"Startup Cost": 0.0, + "Startup Cost": 0.0, +
"Async Capable": false, + "Async Capable": false, +
@ -575,7 +575,7 @@ select jsonb_pretty(
"Plan Rows": 0, + "Plan Rows": 0, +
"Plan Width": 0, + "Plan Width": 0, +
"Total Cost": 0.0, + "Total Cost": 0.0, +
"Actual Rows": 0, + "Actual Rows": 0.0, +
"Actual Loops": 0, + "Actual Loops": 0, +
"Startup Cost": 0.0, + "Startup Cost": 0.0, +
"Async Capable": false, + "Async Capable": false, +

View File

@ -36,17 +36,17 @@ SELECT COUNT(*),AVG(t1.unique1) FROM tenk1 t1
INNER JOIN tenk1 t2 ON t1.unique1 = t2.twenty INNER JOIN tenk1 t2 ON t1.unique1 = t2.twenty
WHERE t2.unique1 < 1000;', false); WHERE t2.unique1 < 1000;', false);
explain_memoize explain_memoize
------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------
Aggregate (actual rows=1 loops=N) Aggregate (actual rows=1 loops=N)
-> Nested Loop (actual rows=1000 loops=N) -> Nested Loop (actual rows=1000 loops=N)
-> Seq Scan on tenk1 t2 (actual rows=1000 loops=N) -> Seq Scan on tenk1 t2 (actual rows=1000 loops=N)
Filter: (unique1 < 1000) Filter: (unique1 < 1000)
Rows Removed by Filter: 9000 Rows Removed by Filter: 9000
-> Memoize (actual rows=1 loops=N) -> Memoize (actual rows=1.00 loops=N)
Cache Key: t2.twenty Cache Key: t2.twenty
Cache Mode: logical Cache Mode: logical
Hits: 980 Misses: 20 Evictions: Zero Overflows: 0 Memory Usage: NkB Hits: 980 Misses: 20 Evictions: Zero Overflows: 0 Memory Usage: NkB
-> Index Only Scan using tenk1_unique1 on tenk1 t1 (actual rows=1 loops=N) -> Index Only Scan using tenk1_unique1 on tenk1 t1 (actual rows=1.00 loops=N)
Index Cond: (unique1 = t2.twenty) Index Cond: (unique1 = t2.twenty)
Heap Fetches: N Heap Fetches: N
(12 rows) (12 rows)
@ -67,17 +67,17 @@ LATERAL (SELECT t2.unique1 FROM tenk1 t2
WHERE t1.twenty = t2.unique1 OFFSET 0) t2 WHERE t1.twenty = t2.unique1 OFFSET 0) t2
WHERE t1.unique1 < 1000;', false); WHERE t1.unique1 < 1000;', false);
explain_memoize explain_memoize
------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------
Aggregate (actual rows=1 loops=N) Aggregate (actual rows=1 loops=N)
-> Nested Loop (actual rows=1000 loops=N) -> Nested Loop (actual rows=1000 loops=N)
-> Seq Scan on tenk1 t1 (actual rows=1000 loops=N) -> Seq Scan on tenk1 t1 (actual rows=1000 loops=N)
Filter: (unique1 < 1000) Filter: (unique1 < 1000)
Rows Removed by Filter: 9000 Rows Removed by Filter: 9000
-> Memoize (actual rows=1 loops=N) -> Memoize (actual rows=1.00 loops=N)
Cache Key: t1.twenty Cache Key: t1.twenty
Cache Mode: binary Cache Mode: binary
Hits: 980 Misses: 20 Evictions: Zero Overflows: 0 Memory Usage: NkB Hits: 980 Misses: 20 Evictions: Zero Overflows: 0 Memory Usage: NkB
-> Index Only Scan using tenk1_unique1 on tenk1 t2 (actual rows=1 loops=N) -> Index Only Scan using tenk1_unique1 on tenk1 t2 (actual rows=1.00 loops=N)
Index Cond: (unique1 = t1.twenty) Index Cond: (unique1 = t1.twenty)
Heap Fetches: N Heap Fetches: N
(12 rows) (12 rows)
@ -101,19 +101,19 @@ LATERAL (
ON t1.two = t2.two ON t1.two = t2.two
WHERE t1.unique1 < 10;', false); WHERE t1.unique1 < 10;', false);
explain_memoize explain_memoize
---------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------
Aggregate (actual rows=1 loops=N) Aggregate (actual rows=1 loops=N)
-> Nested Loop Left Join (actual rows=20 loops=N) -> Nested Loop Left Join (actual rows=20 loops=N)
-> Index Scan using tenk1_unique1 on tenk1 t1 (actual rows=10 loops=N) -> Index Scan using tenk1_unique1 on tenk1 t1 (actual rows=10 loops=N)
Index Cond: (unique1 < 10) Index Cond: (unique1 < 10)
-> Memoize (actual rows=2 loops=N) -> Memoize (actual rows=2.00 loops=N)
Cache Key: t1.two Cache Key: t1.two
Cache Mode: binary Cache Mode: binary
Hits: 8 Misses: 2 Evictions: Zero Overflows: 0 Memory Usage: NkB Hits: 8 Misses: 2 Evictions: Zero Overflows: 0 Memory Usage: NkB
-> Subquery Scan on t2 (actual rows=2 loops=N) -> Subquery Scan on t2 (actual rows=2.00 loops=N)
Filter: (t1.two = t2.two) Filter: (t1.two = t2.two)
Rows Removed by Filter: 2 Rows Removed by Filter: 2
-> Index Scan using tenk1_unique1 on tenk1 t2_1 (actual rows=4 loops=N) -> Index Scan using tenk1_unique1 on tenk1 t2_1 (actual rows=4.00 loops=N)
Index Cond: (unique1 < 4) Index Cond: (unique1 < 4)
(13 rows) (13 rows)
@ -135,17 +135,17 @@ SELECT COUNT(*), AVG(t1.twenty) FROM tenk1 t1 LEFT JOIN
LATERAL (SELECT t1.two+1 AS c1, t2.unique1 AS c2 FROM tenk1 t2) s ON TRUE LATERAL (SELECT t1.two+1 AS c1, t2.unique1 AS c2 FROM tenk1 t2) s ON TRUE
WHERE s.c1 = s.c2 AND t1.unique1 < 1000;', false); WHERE s.c1 = s.c2 AND t1.unique1 < 1000;', false);
explain_memoize explain_memoize
------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------
Aggregate (actual rows=1 loops=N) Aggregate (actual rows=1 loops=N)
-> Nested Loop (actual rows=1000 loops=N) -> Nested Loop (actual rows=1000 loops=N)
-> Seq Scan on tenk1 t1 (actual rows=1000 loops=N) -> Seq Scan on tenk1 t1 (actual rows=1000 loops=N)
Filter: (unique1 < 1000) Filter: (unique1 < 1000)
Rows Removed by Filter: 9000 Rows Removed by Filter: 9000
-> Memoize (actual rows=1 loops=N) -> Memoize (actual rows=1.00 loops=N)
Cache Key: (t1.two + 1) Cache Key: (t1.two + 1)
Cache Mode: binary Cache Mode: binary
Hits: 998 Misses: 2 Evictions: Zero Overflows: 0 Memory Usage: NkB Hits: 998 Misses: 2 Evictions: Zero Overflows: 0 Memory Usage: NkB
-> Index Only Scan using tenk1_unique1 on tenk1 t2 (actual rows=1 loops=N) -> Index Only Scan using tenk1_unique1 on tenk1 t2 (actual rows=1.00 loops=N)
Filter: ((t1.two + 1) = unique1) Filter: ((t1.two + 1) = unique1)
Rows Removed by Filter: 9999 Rows Removed by Filter: 9999
Heap Fetches: N Heap Fetches: N
@ -173,11 +173,11 @@ WHERE s.c1 = s.c2 AND t1.unique1 < 1000;', false);
-> Seq Scan on tenk1 t1 (actual rows=1000 loops=N) -> Seq Scan on tenk1 t1 (actual rows=1000 loops=N)
Filter: (unique1 < 1000) Filter: (unique1 < 1000)
Rows Removed by Filter: 9000 Rows Removed by Filter: 9000
-> Memoize (actual rows=1 loops=N) -> Memoize (actual rows=1.00 loops=N)
Cache Key: t1.two, t1.twenty Cache Key: t1.two, t1.twenty
Cache Mode: binary Cache Mode: binary
Hits: 980 Misses: 20 Evictions: Zero Overflows: 0 Memory Usage: NkB Hits: 980 Misses: 20 Evictions: Zero Overflows: 0 Memory Usage: NkB
-> Seq Scan on tenk1 t2 (actual rows=1 loops=N) -> Seq Scan on tenk1 t2 (actual rows=1.00 loops=N)
Filter: ((t1.twenty = unique1) AND (t1.two = two)) Filter: ((t1.twenty = unique1) AND (t1.two = two))
Rows Removed by Filter: 9999 Rows Removed by Filter: 9999
(12 rows) (12 rows)
@ -208,14 +208,14 @@ SELECT explain_memoize('
SELECT * FROM expr_key t1 INNER JOIN expr_key t2 SELECT * FROM expr_key t1 INNER JOIN expr_key t2
ON t1.x = t2.t::numeric AND t1.t::numeric = t2.x;', false); ON t1.x = t2.t::numeric AND t1.t::numeric = t2.x;', false);
explain_memoize explain_memoize
------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------
Nested Loop (actual rows=80 loops=N) Nested Loop (actual rows=80 loops=N)
-> Seq Scan on expr_key t1 (actual rows=40 loops=N) -> Seq Scan on expr_key t1 (actual rows=40 loops=N)
-> Memoize (actual rows=2 loops=N) -> Memoize (actual rows=2.00 loops=N)
Cache Key: t1.x, (t1.t)::numeric Cache Key: t1.x, (t1.t)::numeric
Cache Mode: logical Cache Mode: logical
Hits: 20 Misses: 20 Evictions: Zero Overflows: 0 Memory Usage: NkB Hits: 20 Misses: 20 Evictions: Zero Overflows: 0 Memory Usage: NkB
-> Index Only Scan using expr_key_idx_x_t on expr_key t2 (actual rows=2 loops=N) -> Index Only Scan using expr_key_idx_x_t on expr_key t2 (actual rows=2.00 loops=N)
Index Cond: (x = (t1.t)::numeric) Index Cond: (x = (t1.t)::numeric)
Filter: (t1.x = (t)::numeric) Filter: (t1.x = (t)::numeric)
Heap Fetches: N Heap Fetches: N
@ -233,17 +233,17 @@ SELECT COUNT(*),AVG(t1.unique1) FROM tenk1 t1
INNER JOIN tenk1 t2 ON t1.unique1 = t2.thousand INNER JOIN tenk1 t2 ON t1.unique1 = t2.thousand
WHERE t2.unique1 < 1200;', true); WHERE t2.unique1 < 1200;', true);
explain_memoize explain_memoize
------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------
Aggregate (actual rows=1 loops=N) Aggregate (actual rows=1 loops=N)
-> Nested Loop (actual rows=1200 loops=N) -> Nested Loop (actual rows=1200 loops=N)
-> Seq Scan on tenk1 t2 (actual rows=1200 loops=N) -> Seq Scan on tenk1 t2 (actual rows=1200 loops=N)
Filter: (unique1 < 1200) Filter: (unique1 < 1200)
Rows Removed by Filter: 8800 Rows Removed by Filter: 8800
-> Memoize (actual rows=1 loops=N) -> Memoize (actual rows=1.00 loops=N)
Cache Key: t2.thousand Cache Key: t2.thousand
Cache Mode: logical Cache Mode: logical
Hits: N Misses: N Evictions: N Overflows: 0 Memory Usage: NkB Hits: N Misses: N Evictions: N Overflows: 0 Memory Usage: NkB
-> Index Only Scan using tenk1_unique1 on tenk1 t1 (actual rows=1 loops=N) -> Index Only Scan using tenk1_unique1 on tenk1 t1 (actual rows=1.00 loops=N)
Index Cond: (unique1 = t2.thousand) Index Cond: (unique1 = t2.thousand)
Heap Fetches: N Heap Fetches: N
(12 rows) (12 rows)
@ -261,7 +261,7 @@ SELECT * FROM flt f1 INNER JOIN flt f2 ON f1.f = f2.f;', false);
Nested Loop (actual rows=4 loops=N) Nested Loop (actual rows=4 loops=N)
-> Index Only Scan using flt_f_idx on flt f1 (actual rows=2 loops=N) -> Index Only Scan using flt_f_idx on flt f1 (actual rows=2 loops=N)
Heap Fetches: N Heap Fetches: N
-> Memoize (actual rows=2 loops=N) -> Memoize (actual rows=2.00 loops=N)
Cache Key: f1.f Cache Key: f1.f
Cache Mode: logical Cache Mode: logical
Hits: 1 Misses: 1 Evictions: Zero Overflows: 0 Memory Usage: NkB Hits: 1 Misses: 1 Evictions: Zero Overflows: 0 Memory Usage: NkB
@ -274,15 +274,15 @@ SELECT * FROM flt f1 INNER JOIN flt f2 ON f1.f = f2.f;', false);
SELECT explain_memoize(' SELECT explain_memoize('
SELECT * FROM flt f1 INNER JOIN flt f2 ON f1.f >= f2.f;', false); SELECT * FROM flt f1 INNER JOIN flt f2 ON f1.f >= f2.f;', false);
explain_memoize explain_memoize
------------------------------------------------------------------------------- ----------------------------------------------------------------------------------
Nested Loop (actual rows=4 loops=N) Nested Loop (actual rows=4 loops=N)
-> Index Only Scan using flt_f_idx on flt f1 (actual rows=2 loops=N) -> Index Only Scan using flt_f_idx on flt f1 (actual rows=2 loops=N)
Heap Fetches: N Heap Fetches: N
-> Memoize (actual rows=2 loops=N) -> Memoize (actual rows=2.00 loops=N)
Cache Key: f1.f Cache Key: f1.f
Cache Mode: binary Cache Mode: binary
Hits: 0 Misses: 2 Evictions: Zero Overflows: 0 Memory Usage: NkB Hits: 0 Misses: 2 Evictions: Zero Overflows: 0 Memory Usage: NkB
-> Index Only Scan using flt_f_idx on flt f2 (actual rows=2 loops=N) -> Index Only Scan using flt_f_idx on flt f2 (actual rows=2.00 loops=N)
Index Cond: (f <= f1.f) Index Cond: (f <= f1.f)
Heap Fetches: N Heap Fetches: N
(10 rows) (10 rows)
@ -301,15 +301,15 @@ ANALYZE strtest;
SELECT explain_memoize(' SELECT explain_memoize('
SELECT * FROM strtest s1 INNER JOIN strtest s2 ON s1.n >= s2.n;', false); SELECT * FROM strtest s1 INNER JOIN strtest s2 ON s1.n >= s2.n;', false);
explain_memoize explain_memoize
---------------------------------------------------------------------------------- -------------------------------------------------------------------------------------
Nested Loop (actual rows=24 loops=N) Nested Loop (actual rows=24 loops=N)
-> Seq Scan on strtest s1 (actual rows=6 loops=N) -> Seq Scan on strtest s1 (actual rows=6 loops=N)
Disabled: true Disabled: true
-> Memoize (actual rows=4 loops=N) -> Memoize (actual rows=4.00 loops=N)
Cache Key: s1.n Cache Key: s1.n
Cache Mode: binary Cache Mode: binary
Hits: 3 Misses: 3 Evictions: Zero Overflows: 0 Memory Usage: NkB Hits: 3 Misses: 3 Evictions: Zero Overflows: 0 Memory Usage: NkB
-> Index Scan using strtest_n_idx on strtest s2 (actual rows=4 loops=N) -> Index Scan using strtest_n_idx on strtest s2 (actual rows=4.00 loops=N)
Index Cond: (n <= s1.n) Index Cond: (n <= s1.n)
(9 rows) (9 rows)
@ -317,15 +317,15 @@ SELECT * FROM strtest s1 INNER JOIN strtest s2 ON s1.n >= s2.n;', false);
SELECT explain_memoize(' SELECT explain_memoize('
SELECT * FROM strtest s1 INNER JOIN strtest s2 ON s1.t >= s2.t;', false); SELECT * FROM strtest s1 INNER JOIN strtest s2 ON s1.t >= s2.t;', false);
explain_memoize explain_memoize
---------------------------------------------------------------------------------- -------------------------------------------------------------------------------------
Nested Loop (actual rows=24 loops=N) Nested Loop (actual rows=24 loops=N)
-> Seq Scan on strtest s1 (actual rows=6 loops=N) -> Seq Scan on strtest s1 (actual rows=6 loops=N)
Disabled: true Disabled: true
-> Memoize (actual rows=4 loops=N) -> Memoize (actual rows=4.00 loops=N)
Cache Key: s1.t Cache Key: s1.t
Cache Mode: binary Cache Mode: binary
Hits: 3 Misses: 3 Evictions: Zero Overflows: 0 Memory Usage: NkB Hits: 3 Misses: 3 Evictions: Zero Overflows: 0 Memory Usage: NkB
-> Index Scan using strtest_t_idx on strtest s2 (actual rows=4 loops=N) -> Index Scan using strtest_t_idx on strtest s2 (actual rows=4.00 loops=N)
Index Cond: (t <= s1.t) Index Cond: (t <= s1.t)
(9 rows) (9 rows)
@ -348,7 +348,7 @@ SELECT * FROM prt t1 INNER JOIN prt t2 ON t1.a = t2.a;', false);
-> Nested Loop (actual rows=16 loops=N) -> Nested Loop (actual rows=16 loops=N)
-> Index Only Scan using iprt_p1_a on prt_p1 t1_1 (actual rows=4 loops=N) -> Index Only Scan using iprt_p1_a on prt_p1 t1_1 (actual rows=4 loops=N)
Heap Fetches: N Heap Fetches: N
-> Memoize (actual rows=4 loops=N) -> Memoize (actual rows=4.00 loops=N)
Cache Key: t1_1.a Cache Key: t1_1.a
Cache Mode: logical Cache Mode: logical
Hits: 3 Misses: 1 Evictions: Zero Overflows: 0 Memory Usage: NkB Hits: 3 Misses: 1 Evictions: Zero Overflows: 0 Memory Usage: NkB
@ -358,7 +358,7 @@ SELECT * FROM prt t1 INNER JOIN prt t2 ON t1.a = t2.a;', false);
-> Nested Loop (actual rows=16 loops=N) -> Nested Loop (actual rows=16 loops=N)
-> Index Only Scan using iprt_p2_a on prt_p2 t1_2 (actual rows=4 loops=N) -> Index Only Scan using iprt_p2_a on prt_p2 t1_2 (actual rows=4 loops=N)
Heap Fetches: N Heap Fetches: N
-> Memoize (actual rows=4 loops=N) -> Memoize (actual rows=4.00 loops=N)
Cache Key: t1_2.a Cache Key: t1_2.a
Cache Mode: logical Cache Mode: logical
Hits: 3 Misses: 1 Evictions: Zero Overflows: 0 Memory Usage: NkB Hits: 3 Misses: 1 Evictions: Zero Overflows: 0 Memory Usage: NkB
@ -378,7 +378,7 @@ ON t1.a = t2.a;', false);
Nested Loop (actual rows=16 loops=N) Nested Loop (actual rows=16 loops=N)
-> Index Only Scan using iprt_p1_a on prt_p1 t1 (actual rows=4 loops=N) -> Index Only Scan using iprt_p1_a on prt_p1 t1 (actual rows=4 loops=N)
Heap Fetches: N Heap Fetches: N
-> Memoize (actual rows=4 loops=N) -> Memoize (actual rows=4.00 loops=N)
Cache Key: t1.a Cache Key: t1.a
Cache Mode: logical Cache Mode: logical
Hits: 3 Misses: 1 Evictions: Zero Overflows: 0 Memory Usage: NkB Hits: 3 Misses: 1 Evictions: Zero Overflows: 0 Memory Usage: NkB

View File

@ -2367,7 +2367,7 @@ begin
$1) $1)
loop loop
ln := regexp_replace(ln, 'Workers Launched: \d+', 'Workers Launched: N'); ln := regexp_replace(ln, 'Workers Launched: \d+', 'Workers Launched: N');
ln := regexp_replace(ln, 'actual rows=\d+ loops=\d+', 'actual rows=N loops=N'); ln := regexp_replace(ln, 'actual rows=\d+(?:\.\d+)? loops=\d+', 'actual rows=N loops=N');
ln := regexp_replace(ln, 'Rows Removed by Filter: \d+', 'Rows Removed by Filter: N'); ln := regexp_replace(ln, 'Rows Removed by Filter: \d+', 'Rows Removed by Filter: N');
return next ln; return next ln;
end loop; end loop;
@ -2940,7 +2940,7 @@ update ab_a1 set b = 3 from ab_a2 where ab_a2.b = (select 1);');
-> Seq Scan on ab_a1_b1 ab_a1_1 (actual rows=1 loops=1) -> Seq Scan on ab_a1_b1 ab_a1_1 (actual rows=1 loops=1)
-> Seq Scan on ab_a1_b2 ab_a1_2 (actual rows=1 loops=1) -> Seq Scan on ab_a1_b2 ab_a1_2 (actual rows=1 loops=1)
-> Seq Scan on ab_a1_b3 ab_a1_3 (actual rows=1 loops=1) -> Seq Scan on ab_a1_b3 ab_a1_3 (actual rows=1 loops=1)
-> Materialize (actual rows=1 loops=3) -> Materialize (actual rows=1.00 loops=3)
Storage: Memory Maximum Storage: NkB Storage: Memory Maximum Storage: NkB
-> Append (actual rows=1 loops=1) -> Append (actual rows=1 loops=1)
-> Seq Scan on ab_a2_b1 ab_a2_1 (actual rows=1 loops=1) -> Seq Scan on ab_a2_b1 ab_a2_1 (actual rows=1 loops=1)
@ -2984,11 +2984,11 @@ set enable_mergejoin = off;
explain (analyze, costs off, summary off, timing off, buffers off) explain (analyze, costs off, summary off, timing off, buffers off)
select * from tbl1 join tprt on tbl1.col1 > tprt.col1; select * from tbl1 join tprt on tbl1.col1 > tprt.col1;
QUERY PLAN QUERY PLAN
-------------------------------------------------------------------------- -----------------------------------------------------------------------------
Nested Loop (actual rows=6 loops=1) Nested Loop (actual rows=6 loops=1)
-> Seq Scan on tbl1 (actual rows=2 loops=1) -> Seq Scan on tbl1 (actual rows=2 loops=1)
-> Append (actual rows=3 loops=2) -> Append (actual rows=3.00 loops=2)
-> Index Scan using tprt1_idx on tprt_1 (actual rows=2 loops=2) -> Index Scan using tprt1_idx on tprt_1 (actual rows=2.00 loops=2)
Index Cond: (col1 < tbl1.col1) Index Cond: (col1 < tbl1.col1)
-> Index Scan using tprt2_idx on tprt_2 (actual rows=2 loops=1) -> Index Scan using tprt2_idx on tprt_2 (actual rows=2 loops=1)
Index Cond: (col1 < tbl1.col1) Index Cond: (col1 < tbl1.col1)
@ -3005,13 +3005,13 @@ select * from tbl1 join tprt on tbl1.col1 > tprt.col1;
explain (analyze, costs off, summary off, timing off, buffers off) explain (analyze, costs off, summary off, timing off, buffers off)
select * from tbl1 join tprt on tbl1.col1 = tprt.col1; select * from tbl1 join tprt on tbl1.col1 = tprt.col1;
QUERY PLAN QUERY PLAN
-------------------------------------------------------------------------- -----------------------------------------------------------------------------
Nested Loop (actual rows=2 loops=1) Nested Loop (actual rows=2 loops=1)
-> Seq Scan on tbl1 (actual rows=2 loops=1) -> Seq Scan on tbl1 (actual rows=2 loops=1)
-> Append (actual rows=1 loops=2) -> Append (actual rows=1.00 loops=2)
-> Index Scan using tprt1_idx on tprt_1 (never executed) -> Index Scan using tprt1_idx on tprt_1 (never executed)
Index Cond: (col1 = tbl1.col1) Index Cond: (col1 = tbl1.col1)
-> Index Scan using tprt2_idx on tprt_2 (actual rows=1 loops=2) -> Index Scan using tprt2_idx on tprt_2 (actual rows=1.00 loops=2)
Index Cond: (col1 = tbl1.col1) Index Cond: (col1 = tbl1.col1)
-> Index Scan using tprt3_idx on tprt_3 (never executed) -> Index Scan using tprt3_idx on tprt_3 (never executed)
Index Cond: (col1 = tbl1.col1) Index Cond: (col1 = tbl1.col1)
@ -3050,15 +3050,15 @@ insert into tbl1 values (1001), (1010), (1011);
explain (analyze, costs off, summary off, timing off, buffers off) explain (analyze, costs off, summary off, timing off, buffers off)
select * from tbl1 inner join tprt on tbl1.col1 > tprt.col1; select * from tbl1 inner join tprt on tbl1.col1 > tprt.col1;
QUERY PLAN QUERY PLAN
-------------------------------------------------------------------------- -----------------------------------------------------------------------------
Nested Loop (actual rows=23 loops=1) Nested Loop (actual rows=23 loops=1)
-> Seq Scan on tbl1 (actual rows=5 loops=1) -> Seq Scan on tbl1 (actual rows=5 loops=1)
-> Append (actual rows=5 loops=5) -> Append (actual rows=4.60 loops=5)
-> Index Scan using tprt1_idx on tprt_1 (actual rows=2 loops=5) -> Index Scan using tprt1_idx on tprt_1 (actual rows=2.00 loops=5)
Index Cond: (col1 < tbl1.col1) Index Cond: (col1 < tbl1.col1)
-> Index Scan using tprt2_idx on tprt_2 (actual rows=3 loops=4) -> Index Scan using tprt2_idx on tprt_2 (actual rows=2.75 loops=4)
Index Cond: (col1 < tbl1.col1) Index Cond: (col1 < tbl1.col1)
-> Index Scan using tprt3_idx on tprt_3 (actual rows=1 loops=2) -> Index Scan using tprt3_idx on tprt_3 (actual rows=1.00 loops=2)
Index Cond: (col1 < tbl1.col1) Index Cond: (col1 < tbl1.col1)
-> Index Scan using tprt4_idx on tprt_4 (never executed) -> Index Scan using tprt4_idx on tprt_4 (never executed)
Index Cond: (col1 < tbl1.col1) Index Cond: (col1 < tbl1.col1)
@ -3071,15 +3071,15 @@ select * from tbl1 inner join tprt on tbl1.col1 > tprt.col1;
explain (analyze, costs off, summary off, timing off, buffers off) explain (analyze, costs off, summary off, timing off, buffers off)
select * from tbl1 inner join tprt on tbl1.col1 = tprt.col1; select * from tbl1 inner join tprt on tbl1.col1 = tprt.col1;
QUERY PLAN QUERY PLAN
-------------------------------------------------------------------------- -----------------------------------------------------------------------------
Nested Loop (actual rows=3 loops=1) Nested Loop (actual rows=3 loops=1)
-> Seq Scan on tbl1 (actual rows=5 loops=1) -> Seq Scan on tbl1 (actual rows=5 loops=1)
-> Append (actual rows=1 loops=5) -> Append (actual rows=0.60 loops=5)
-> Index Scan using tprt1_idx on tprt_1 (never executed) -> Index Scan using tprt1_idx on tprt_1 (never executed)
Index Cond: (col1 = tbl1.col1) Index Cond: (col1 = tbl1.col1)
-> Index Scan using tprt2_idx on tprt_2 (actual rows=1 loops=2) -> Index Scan using tprt2_idx on tprt_2 (actual rows=1.00 loops=2)
Index Cond: (col1 = tbl1.col1) Index Cond: (col1 = tbl1.col1)
-> Index Scan using tprt3_idx on tprt_3 (actual rows=0 loops=3) -> Index Scan using tprt3_idx on tprt_3 (actual rows=0.33 loops=3)
Index Cond: (col1 = tbl1.col1) Index Cond: (col1 = tbl1.col1)
-> Index Scan using tprt4_idx on tprt_4 (never executed) -> Index Scan using tprt4_idx on tprt_4 (never executed)
Index Cond: (col1 = tbl1.col1) Index Cond: (col1 = tbl1.col1)

View File

@ -584,16 +584,16 @@ explain (analyze, timing off, summary off, costs off, buffers off)
select count(*) from tenk1, tenk2 where tenk1.hundred > 1 select count(*) from tenk1, tenk2 where tenk1.hundred > 1
and tenk2.thousand=0; and tenk2.thousand=0;
QUERY PLAN QUERY PLAN
-------------------------------------------------------------------------- -----------------------------------------------------------------------------
Aggregate (actual rows=1 loops=1) Aggregate (actual rows=1 loops=1)
-> Nested Loop (actual rows=98000 loops=1) -> Nested Loop (actual rows=98000 loops=1)
-> Seq Scan on tenk2 (actual rows=10 loops=1) -> Seq Scan on tenk2 (actual rows=10 loops=1)
Filter: (thousand = 0) Filter: (thousand = 0)
Rows Removed by Filter: 9990 Rows Removed by Filter: 9990
-> Gather (actual rows=9800 loops=10) -> Gather (actual rows=9800.00 loops=10)
Workers Planned: 4 Workers Planned: 4
Workers Launched: 4 Workers Launched: 4
-> Parallel Seq Scan on tenk1 (actual rows=1960 loops=50) -> Parallel Seq Scan on tenk1 (actual rows=1960.00 loops=50)
Filter: (hundred > 1) Filter: (hundred > 1)
Rows Removed by Filter: 40 Rows Removed by Filter: 40
(11 rows) (11 rows)
@ -618,20 +618,20 @@ end;
$$; $$;
select * from explain_parallel_sort_stats(); select * from explain_parallel_sort_stats();
explain_parallel_sort_stats explain_parallel_sort_stats
-------------------------------------------------------------------------- -----------------------------------------------------------------------------
Nested Loop Left Join (actual rows=30000 loops=1) Nested Loop Left Join (actual rows=30000 loops=1)
-> Values Scan on "*VALUES*" (actual rows=3 loops=1) -> Values Scan on "*VALUES*" (actual rows=3 loops=1)
-> Gather Merge (actual rows=10000 loops=3) -> Gather Merge (actual rows=10000.00 loops=3)
Workers Planned: 4 Workers Planned: 4
Workers Launched: 4 Workers Launched: 4
-> Sort (actual rows=2000 loops=15) -> Sort (actual rows=2000.00 loops=15)
Sort Key: tenk1.ten Sort Key: tenk1.ten
Sort Method: quicksort Memory: xxx Sort Method: quicksort Memory: xxx
Worker 0: Sort Method: quicksort Memory: xxx Worker 0: Sort Method: quicksort Memory: xxx
Worker 1: Sort Method: quicksort Memory: xxx Worker 1: Sort Method: quicksort Memory: xxx
Worker 2: Sort Method: quicksort Memory: xxx Worker 2: Sort Method: quicksort Memory: xxx
Worker 3: Sort Method: quicksort Memory: xxx Worker 3: Sort Method: quicksort Memory: xxx
-> Parallel Seq Scan on tenk1 (actual rows=2000 loops=15) -> Parallel Seq Scan on tenk1 (actual rows=2000.00 loops=15)
Filter: (ten < 100) Filter: (ten < 100)
(14 rows) (14 rows)
@ -1171,11 +1171,11 @@ SAVEPOINT settings;
SET LOCAL debug_parallel_query = 1; SET LOCAL debug_parallel_query = 1;
EXPLAIN (analyze, timing off, summary off, costs off, buffers off) SELECT * FROM tenk1; EXPLAIN (analyze, timing off, summary off, costs off, buffers off) SELECT * FROM tenk1;
QUERY PLAN QUERY PLAN
------------------------------------------------------------- ----------------------------------------------------------------
Gather (actual rows=10000 loops=1) Gather (actual rows=10000 loops=1)
Workers Planned: 4 Workers Planned: 4
Workers Launched: 4 Workers Launched: 4
-> Parallel Seq Scan on tenk1 (actual rows=2000 loops=5) -> Parallel Seq Scan on tenk1 (actual rows=2000.00 loops=5)
(4 rows) (4 rows)
ROLLBACK TO SAVEPOINT settings; ROLLBACK TO SAVEPOINT settings;

View File

@ -586,7 +586,7 @@ begin
$1) $1)
loop loop
ln := regexp_replace(ln, 'Workers Launched: \d+', 'Workers Launched: N'); ln := regexp_replace(ln, 'Workers Launched: \d+', 'Workers Launched: N');
ln := regexp_replace(ln, 'actual rows=\d+ loops=\d+', 'actual rows=N loops=N'); ln := regexp_replace(ln, 'actual rows=\d+(?:\.\d+)? loops=\d+', 'actual rows=N loops=N');
ln := regexp_replace(ln, 'Rows Removed by Filter: \d+', 'Rows Removed by Filter: N'); ln := regexp_replace(ln, 'Rows Removed by Filter: \d+', 'Rows Removed by Filter: N');
return next ln; return next ln;
end loop; end loop;