diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2022-05-18 18:33:04 +0200 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2022-05-18 18:33:04 +0200 |
commit | 598ac10be1c20961baac44db773eb826f788fdfa (patch) | |
tree | 27a34cdcc94a5aaac5f4926deea697b92858c9c6 /src/backend/commands/explain.c | |
parent | 81e3c83d988daa8fd763ec5104d540713832dd1a (diff) | |
download | postgresql-598ac10be1c20961baac44db773eb826f788fdfa.tar.gz postgresql-598ac10be1c20961baac44db773eb826f788fdfa.zip |
Make EXPLAIN MERGE output format more compact
We can use a single line to print all tuple counts that MERGE processed,
for conciseness, and elide those that are zeroes. Non-text formats
report all numbers, as is typical.
Per comment from Justin Pryzby <pryzby@telsasoft.com>
Discussion: https://postgr.es/m/20220511163350.GL19626@telsasoft.com
Diffstat (limited to 'src/backend/commands/explain.c')
-rw-r--r-- | src/backend/commands/explain.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c index c461061fe9e..2de546f16eb 100644 --- a/src/backend/commands/explain.c +++ b/src/backend/commands/explain.c @@ -4068,10 +4068,27 @@ show_modifytable_info(ModifyTableState *mtstate, List *ancestors, skipped_path = total - insert_path - update_path - delete_path; Assert(skipped_path >= 0); - ExplainPropertyFloat("Tuples Inserted", NULL, insert_path, 0, es); - ExplainPropertyFloat("Tuples Updated", NULL, update_path, 0, es); - ExplainPropertyFloat("Tuples Deleted", NULL, delete_path, 0, es); - ExplainPropertyFloat("Tuples Skipped", NULL, skipped_path, 0, es); + if (es->format == EXPLAIN_FORMAT_TEXT && total > 0) + { + ExplainIndentText(es); + appendStringInfoString(es->str, "Tuples:"); + if (insert_path > 0) + appendStringInfo(es->str, " inserted=%.0f", insert_path); + if (update_path > 0) + appendStringInfo(es->str, " updated=%.0f", update_path); + if (delete_path > 0) + appendStringInfo(es->str, " deleted=%.0f", delete_path); + if (skipped_path > 0) + appendStringInfo(es->str, " skipped=%.0f", skipped_path); + appendStringInfoChar(es->str, '\n'); + } + else + { + ExplainPropertyFloat("Tuples Inserted", NULL, insert_path, 0, es); + ExplainPropertyFloat("Tuples Updated", NULL, update_path, 0, es); + ExplainPropertyFloat("Tuples Deleted", NULL, delete_path, 0, es); + ExplainPropertyFloat("Tuples Skipped", NULL, skipped_path, 0, es); + } } } |