On Fri, Apr 10, 2020 at 9:37 PM Julien Rouhaud <rjuju...@gmail.com> wrote: > > On Fri, Apr 10, 2020 at 8:17 AM Amit Kapila <amit.kapil...@gmail.com> wrote: > > Would you like to send a consolidated patch that includes Euler's > > suggestion and Justin's patch (by making changes for points we > > discussed.)? I think we can keep the point related to number of > > spaces before each field open? > > Sure, I'll take care of that tomorrow!
I tried to take into account all that have been discussed, but I have to admit that I'm absolutely not sure of what was actually decided here. I went with those changes: - rename wal_num_fpw to wal_fpw for consistency, both in pgss view fiel name but also everywhere in the code - change comments to consistently mention "full page writes generated" - changed pgss and explain documentation to mention "full page images generated", from Justin's patch on another thread - kept "amount" of WAL bytes - no change to the explain output as I have no idea what is the consensus (one or two spaces, use semicolon or equal, show unit or not)
diff --git a/contrib/pg_stat_statements/pg_stat_statements--1.7--1.8.sql b/contrib/pg_stat_statements/pg_stat_statements--1.7--1.8.sql index 30566574ab..d0a6c3b4fc 100644 --- a/contrib/pg_stat_statements/pg_stat_statements--1.7--1.8.sql +++ b/contrib/pg_stat_statements/pg_stat_statements--1.7--1.8.sql @@ -43,7 +43,7 @@ CREATE FUNCTION pg_stat_statements(IN showtext boolean, OUT blk_read_time float8, OUT blk_write_time float8, OUT wal_records int8, - OUT wal_num_fpw int8, + OUT wal_fpw int8, OUT wal_bytes numeric ) RETURNS SETOF record diff --git a/contrib/pg_stat_statements/pg_stat_statements.c b/contrib/pg_stat_statements/pg_stat_statements.c index 04abdab904..90bc6fd013 100644 --- a/contrib/pg_stat_statements/pg_stat_statements.c +++ b/contrib/pg_stat_statements/pg_stat_statements.c @@ -189,7 +189,7 @@ typedef struct Counters double blk_write_time; /* time spent writing, in msec */ double usage; /* usage factor */ int64 wal_records; /* # of WAL records generated */ - int64 wal_num_fpw; /* # of WAL full page image records generated */ + int64 wal_fpw; /* # of WAL full page writes generated */ uint64 wal_bytes; /* total amount of WAL bytes generated */ } Counters; @@ -1432,7 +1432,7 @@ pgss_store(const char *query, uint64 queryId, e->counters.blk_write_time += INSTR_TIME_GET_MILLISEC(bufusage->blk_write_time); e->counters.usage += USAGE_EXEC(total_time); e->counters.wal_records += walusage->wal_records; - e->counters.wal_num_fpw += walusage->wal_num_fpw; + e->counters.wal_fpw += walusage->wal_fpw; e->counters.wal_bytes += walusage->wal_bytes; SpinLockRelease(&e->mutex); @@ -1824,7 +1824,7 @@ pg_stat_statements_internal(FunctionCallInfo fcinfo, Datum wal_bytes; values[i++] = Int64GetDatumFast(tmp.wal_records); - values[i++] = Int64GetDatumFast(tmp.wal_num_fpw); + values[i++] = Int64GetDatumFast(tmp.wal_fpw); snprintf(buf, sizeof buf, UINT64_FORMAT, tmp.wal_bytes); diff --git a/doc/src/sgml/pgstatstatements.sgml b/doc/src/sgml/pgstatstatements.sgml index 5a962feb39..f0b769fad8 100644 --- a/doc/src/sgml/pgstatstatements.sgml +++ b/doc/src/sgml/pgstatstatements.sgml @@ -283,11 +283,11 @@ </row> <row> - <entry><structfield>wal_num_fpw</structfield></entry> + <entry><structfield>wal_fpw</structfield></entry> <entry><type>bigint</type></entry> <entry></entry> <entry> - Total count of WAL full page writes generated by the statement + Total count of WAL full page images generated by the statement </entry> </row> diff --git a/doc/src/sgml/ref/explain.sgml b/doc/src/sgml/ref/explain.sgml index 024ede4a8d..1e12715a03 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 image records and amount of WAL - bytes generated. In text format, only non-zero values are printed. This + number of records, number of full page images 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/access/heap/vacuumlazy.c b/src/backend/access/heap/vacuumlazy.c index f3382d37a4..d8bc06fe0b 100644 --- a/src/backend/access/heap/vacuumlazy.c +++ b/src/backend/access/heap/vacuumlazy.c @@ -676,7 +676,7 @@ heap_vacuum_rel(Relation onerel, VacuumParams *params, _("WAL usage: %ld records, %ld full page writes, " UINT64_FORMAT " bytes"), walusage.wal_records, - walusage.wal_num_fpw, + walusage.wal_fpw, walusage.wal_bytes); ereport(LOG, diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index c38bc1412d..11e32733c4 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -1258,7 +1258,7 @@ XLogInsertRecord(XLogRecData *rdata, { pgWalUsage.wal_bytes += rechdr->xl_tot_len; pgWalUsage.wal_records++; - pgWalUsage.wal_num_fpw += num_fpw; + pgWalUsage.wal_fpw += num_fpw; } return EndPos; diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c index 455f54ef83..57ab676572 100644 --- a/src/backend/commands/explain.c +++ b/src/backend/commands/explain.c @@ -3355,7 +3355,7 @@ show_wal_usage(ExplainState *es, const WalUsage *usage) if (es->format == EXPLAIN_FORMAT_TEXT) { /* Show only positive counter values. */ - if ((usage->wal_records > 0) || (usage->wal_num_fpw > 0) || + if ((usage->wal_records > 0) || (usage->wal_fpw > 0) || (usage->wal_bytes > 0)) { ExplainIndentText(es); @@ -3364,9 +3364,9 @@ show_wal_usage(ExplainState *es, const WalUsage *usage) if (usage->wal_records > 0) appendStringInfo(es->str, " records=%ld", usage->wal_records); - if (usage->wal_num_fpw > 0) + if (usage->wal_fpw > 0) appendStringInfo(es->str, " full page writes=%ld", - usage->wal_num_fpw); + usage->wal_fpw); if (usage->wal_bytes > 0) appendStringInfo(es->str, " bytes=" UINT64_FORMAT, usage->wal_bytes); @@ -3378,7 +3378,7 @@ show_wal_usage(ExplainState *es, const WalUsage *usage) ExplainPropertyInteger("WAL records", NULL, usage->wal_records, es); ExplainPropertyInteger("WAL full page writes", NULL, - usage->wal_num_fpw, es); + usage->wal_fpw, es); ExplainPropertyUInteger("WAL bytes", NULL, usage->wal_bytes, es); } diff --git a/src/backend/executor/instrument.c b/src/backend/executor/instrument.c index 3b9c6aebb9..7c9d723552 100644 --- a/src/backend/executor/instrument.c +++ b/src/backend/executor/instrument.c @@ -248,7 +248,7 @@ WalUsageAdd(WalUsage *dst, WalUsage *add) { dst->wal_bytes += add->wal_bytes; dst->wal_records += add->wal_records; - dst->wal_num_fpw += add->wal_num_fpw; + dst->wal_fpw += add->wal_fpw; } void @@ -256,5 +256,5 @@ WalUsageAccumDiff(WalUsage *dst, const WalUsage *add, const WalUsage *sub) { dst->wal_bytes += add->wal_bytes - sub->wal_bytes; dst->wal_records += add->wal_records - sub->wal_records; - dst->wal_num_fpw += add->wal_num_fpw - sub->wal_num_fpw; + dst->wal_fpw += add->wal_fpw - sub->wal_fpw; } diff --git a/src/include/executor/instrument.h b/src/include/executor/instrument.h index 64439c6819..50d672b270 100644 --- a/src/include/executor/instrument.h +++ b/src/include/executor/instrument.h @@ -35,7 +35,7 @@ typedef struct BufferUsage typedef struct WalUsage { long wal_records; /* # of WAL records produced */ - long wal_num_fpw; /* # of WAL full page image writes produced */ + long wal_fpw; /* # of WAL full page writes produced */ uint64 wal_bytes; /* size of WAL records produced */ } WalUsage;