aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/explain.c
diff options
context:
space:
mode:
authorFujii Masao <fujii@postgresql.org>2014-07-14 20:40:14 +0900
committerFujii Masao <fujii@postgresql.org>2014-07-14 20:40:14 +0900
commitd4635b16fe3d0fae65d7735d9e926a1b20a90781 (patch)
treec77b56bf3ccbee40c4b7d270ef9214fbbc0bc287 /src/backend/commands/explain.c
parentab774859456eb441ef049bf66af38b259cbdacce (diff)
downloadpostgresql-d4635b16fe3d0fae65d7735d9e926a1b20a90781.tar.gz
postgresql-d4635b16fe3d0fae65d7735d9e926a1b20a90781.zip
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
Diffstat (limited to 'src/backend/commands/explain.c')
-rw-r--r--src/backend/commands/explain.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c
index 0d9663cd8db..781a736115a 100644
--- a/src/backend/commands/explain.c
+++ b/src/backend/commands/explain.c
@@ -1937,13 +1937,16 @@ show_tidbitmap_info(BitmapHeapScanState *planstate, ExplainState *es)
}
else
{
- appendStringInfoSpaces(es->str, es->indent * 2);
- appendStringInfoString(es->str, "Heap Blocks:");
- if (planstate->exact_pages > 0)
- appendStringInfo(es->str, " exact=%ld", planstate->exact_pages);
- if (planstate->lossy_pages > 0)
- appendStringInfo(es->str, " lossy=%ld", planstate->lossy_pages);
- appendStringInfoChar(es->str, '\n');
+ if (planstate->exact_pages > 0 || planstate->lossy_pages > 0)
+ {
+ appendStringInfoSpaces(es->str, es->indent * 2);
+ appendStringInfoString(es->str, "Heap Blocks:");
+ if (planstate->exact_pages > 0)
+ appendStringInfo(es->str, " exact=%ld", planstate->exact_pages);
+ if (planstate->lossy_pages > 0)
+ appendStringInfo(es->str, " lossy=%ld", planstate->lossy_pages);
+ appendStringInfoChar(es->str, '\n');
+ }
}
}