v2-fix_explain_wal_output.diff
text/x-patch
Filename: v2-fix_explain_wal_output.diff
Type: text/x-patch
Part: 0
Message:
Re: WAL usage calculation patch
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: unified
Series: patch v2
| File | + | − |
|---|---|---|
| doc/src/sgml/ref/explain.sgml | 2 | 2 |
| src/backend/commands/explain.c | 4 | 4 |
diff --git a/doc/src/sgml/ref/explain.sgml b/doc/src/sgml/ref/explain.sgml
index aedd70a6ad..e5b50d3790 100644
--- a/doc/src/sgml/ref/explain.sgml
+++ b/doc/src/sgml/ref/explain.sgml
@@ -198,8 +198,8 @@ ROLLBACK;
<listitem>
<para>
Include information on WAL record generation. Specifically, include the
- number of records, number of full page writes and amount of WAL bytes
- generated. In text format, only non-zero values are printed. This
+ number of records, number of full page writes (fpw) and amount of WAL
+ bytes generated. In text format, only non-zero values are printed. This
parameter may only be used when <literal>ANALYZE</literal> is also
enabled. It defaults to <literal>FALSE</literal>.
</para>
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c
index 7ae6131676..9cc1b13b76 100644
--- a/src/backend/commands/explain.c
+++ b/src/backend/commands/explain.c
@@ -3350,13 +3350,13 @@ show_wal_usage(ExplainState *es, const WalUsage *usage)
appendStringInfoString(es->str, "WAL:");
if (usage->wal_records > 0)
- appendStringInfo(es->str, " records=%ld",
+ appendStringInfo(es->str, " records=%ld",
usage->wal_records);
if (usage->wal_fpw > 0)
- appendStringInfo(es->str, " full page writes=%ld",
+ appendStringInfo(es->str, " fpw=%ld",
usage->wal_fpw);
if (usage->wal_bytes > 0)
- appendStringInfo(es->str, " bytes=" UINT64_FORMAT,
+ appendStringInfo(es->str, " bytes=" UINT64_FORMAT,
usage->wal_bytes);
appendStringInfoChar(es->str, '\n');
}
@@ -3365,7 +3365,7 @@ show_wal_usage(ExplainState *es, const WalUsage *usage)
{
ExplainPropertyInteger("WAL records", NULL,
usage->wal_records, es);
- ExplainPropertyInteger("WAL full page writes", NULL,
+ ExplainPropertyInteger("WAL fpw", NULL,
usage->wal_fpw, es);
ExplainPropertyUInteger("WAL bytes", NULL,
usage->wal_bytes, es);