Skip to content

Commit 320545b

Browse files
committed
Add information about WAL buffers being full to EXPLAIN (WAL)
This is similar to ce5bcc4, relying on the addition of wal_buffers_full to WalUsage. This time, the information is added to the output generated by EXPLAIN (WAL). Author: Bertrand Drouvot Reviewed-by: Ilia Evdokimov Discussion: https://postgr.es/m/Z6SOha5YFFgvpwQY@ip-10-97-1-34.eu-west-3.compute.internal
1 parent ce5bcc4 commit 320545b

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

doc/src/sgml/ref/explain.sgml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,9 @@ ROLLBACK;
242242
<listitem>
243243
<para>
244244
Include information on WAL record generation. Specifically, include the
245-
number of records, number of full page images (fpi) and the amount of WAL
246-
generated in bytes. In text format, only non-zero values are printed.
245+
number of records, number of full page images (fpi), the amount of WAL
246+
generated in bytes and the number of times the WAL buffers became full.
247+
In text format, only non-zero values are printed.
247248
This parameter may only be used when <literal>ANALYZE</literal> is also
248249
enabled. It defaults to <literal>FALSE</literal>.
249250
</para>

src/backend/commands/explain.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4242,7 +4242,7 @@ show_wal_usage(ExplainState *es, const WalUsage *usage)
42424242
{
42434243
/* Show only positive counter values. */
42444244
if ((usage->wal_records > 0) || (usage->wal_fpi > 0) ||
4245-
(usage->wal_bytes > 0))
4245+
(usage->wal_bytes > 0) || (usage->wal_buffers_full > 0))
42464246
{
42474247
ExplainIndentText(es);
42484248
appendStringInfoString(es->str, "WAL:");
@@ -4256,6 +4256,9 @@ show_wal_usage(ExplainState *es, const WalUsage *usage)
42564256
if (usage->wal_bytes > 0)
42574257
appendStringInfo(es->str, " bytes=" UINT64_FORMAT,
42584258
usage->wal_bytes);
4259+
if (usage->wal_buffers_full > 0)
4260+
appendStringInfo(es->str, " buffers full=%lld",
4261+
(long long) usage->wal_buffers_full);
42594262
appendStringInfoChar(es->str, '\n');
42604263
}
42614264
}
@@ -4267,6 +4270,8 @@ show_wal_usage(ExplainState *es, const WalUsage *usage)
42674270
usage->wal_fpi, es);
42684271
ExplainPropertyUInteger("WAL Bytes", NULL,
42694272
usage->wal_bytes, es);
4273+
ExplainPropertyInteger("WAL Buffers Full", NULL,
4274+
usage->wal_buffers_full, es);
42704275
}
42714276
}
42724277

0 commit comments

Comments
 (0)