1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

Change the display of WAL usage statistics in Explain.

In commit 33e05f89c5, we have added the option to display WAL usage
statistics in Explain and auto_explain.  The display format used two spaces
between each field which is inconsistent with Buffer usage statistics which
is using one space between each field.  Change the format to make WAL usage
statistics consistent with Buffer usage statistics.

This commit also changed the usage of "full page writes" to
"full page images" for WAL usage statistics to make it consistent with
other parts of code and docs.

Author: Julien Rouhaud, Amit Kapila
Reviewed-by: Justin Pryzby, Kyotaro Horiguchi and Amit Kapila
Discussion: https://postgr.es/m/CAB-hujrP8ZfUkvL5OYETipQwA=e3n7oqHFU=4ZLxWS_Cza3kQQ@mail.gmail.com
This commit is contained in:
Amit Kapila
2020-05-05 08:00:53 +05:30
parent 5545b69ae6
commit 69bfaf2e1d
11 changed files with 32 additions and 32 deletions

View File

@ -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_fpw int8,
OUT wal_fpi int8,
OUT wal_bytes numeric
)
RETURNS SETOF record

View File

@ -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_fpw; /* # of WAL full page writes generated */
int64 wal_fpi; /* # of WAL full page images 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_fpw += walusage->wal_fpw;
e->counters.wal_fpi += walusage->wal_fpi;
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_fpw);
values[i++] = Int64GetDatumFast(tmp.wal_fpi);
snprintf(buf, sizeof buf, UINT64_FORMAT, tmp.wal_bytes);