Skip to content

Commit d4635b1

Browse files
committed
Prevent bitmap heap scans from showing unnecessary block info in EXPLAIN ANALYZE.
EXPLAIN ANALYZE shows the information of the numbers of exact/lossy blocks which bitmap heap scan processes. But, previously, when those numbers were both zero, it displayed only the prefix "Heap Blocks:" in TEXT output format. This is strange and would confuse the users. So this commit suppresses such unnecessary information. Backpatch to 9.4 where EXPLAIN ANALYZE was changed so that such information was displayed. Etsuro Fujita
1 parent ab77485 commit d4635b1

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/backend/commands/explain.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1937,13 +1937,16 @@ show_tidbitmap_info(BitmapHeapScanState *planstate, ExplainState *es)
19371937
}
19381938
else
19391939
{
1940-
appendStringInfoSpaces(es->str, es->indent * 2);
1941-
appendStringInfoString(es->str, "Heap Blocks:");
1942-
if (planstate->exact_pages > 0)
1943-
appendStringInfo(es->str, " exact=%ld", planstate->exact_pages);
1944-
if (planstate->lossy_pages > 0)
1945-
appendStringInfo(es->str, " lossy=%ld", planstate->lossy_pages);
1946-
appendStringInfoChar(es->str, '\n');
1940+
if (planstate->exact_pages > 0 || planstate->lossy_pages > 0)
1941+
{
1942+
appendStringInfoSpaces(es->str, es->indent * 2);
1943+
appendStringInfoString(es->str, "Heap Blocks:");
1944+
if (planstate->exact_pages > 0)
1945+
appendStringInfo(es->str, " exact=%ld", planstate->exact_pages);
1946+
if (planstate->lossy_pages > 0)
1947+
appendStringInfo(es->str, " lossy=%ld", planstate->lossy_pages);
1948+
appendStringInfoChar(es->str, '\n');
1949+
}
19471950
}
19481951
}
19491952

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy