Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit69bfaf2

Browse files
author
Amit Kapila
committed
Change the display of WAL usage statistics in Explain.
In commit33e05f8, we have added the option to display WAL usagestatistics in Explain and auto_explain. The display format used two spacesbetween each field which is inconsistent with Buffer usage statistics whichis using one space between each field. Change the format to make WAL usagestatistics 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 withother parts of code and docs.Author: Julien Rouhaud, Amit KapilaReviewed-by: Justin Pryzby, Kyotaro Horiguchi and Amit KapilaDiscussion:https://postgr.es/m/CAB-hujrP8ZfUkvL5OYETipQwA=e3n7oqHFU=4ZLxWS_Cza3kQQ@mail.gmail.com
1 parent5545b69 commit69bfaf2

File tree

11 files changed

+32
-32
lines changed

11 files changed

+32
-32
lines changed

‎contrib/pg_stat_statements/pg_stat_statements--1.7--1.8.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ CREATE FUNCTION pg_stat_statements(IN showtext boolean,
4343
OUT blk_read_time float8,
4444
OUT blk_write_time float8,
4545
OUT wal_records int8,
46-
OUTwal_fpw int8,
46+
OUTwal_fpi int8,
4747
OUT wal_bytesnumeric
4848
)
4949
RETURNS SETOF record

‎contrib/pg_stat_statements/pg_stat_statements.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ typedef struct Counters
189189
doubleblk_write_time;/* time spent writing, in msec */
190190
doubleusage;/* usage factor */
191191
int64wal_records;/* # of WAL records generated */
192-
int64wal_fpw;/* # of WAL full pagewrites generated */
192+
int64wal_fpi;/* # of WAL full pageimages generated */
193193
uint64wal_bytes;/* total amount of WAL bytes generated */
194194
}Counters;
195195

@@ -1432,7 +1432,7 @@ pgss_store(const char *query, uint64 queryId,
14321432
e->counters.blk_write_time+=INSTR_TIME_GET_MILLISEC(bufusage->blk_write_time);
14331433
e->counters.usage+=USAGE_EXEC(total_time);
14341434
e->counters.wal_records+=walusage->wal_records;
1435-
e->counters.wal_fpw+=walusage->wal_fpw;
1435+
e->counters.wal_fpi+=walusage->wal_fpi;
14361436
e->counters.wal_bytes+=walusage->wal_bytes;
14371437

14381438
SpinLockRelease(&e->mutex);
@@ -1824,7 +1824,7 @@ pg_stat_statements_internal(FunctionCallInfo fcinfo,
18241824
Datumwal_bytes;
18251825

18261826
values[i++]=Int64GetDatumFast(tmp.wal_records);
1827-
values[i++]=Int64GetDatumFast(tmp.wal_fpw);
1827+
values[i++]=Int64GetDatumFast(tmp.wal_fpi);
18281828

18291829
snprintf(buf,sizeofbuf,UINT64_FORMAT,tmp.wal_bytes);
18301830

‎doc/src/sgml/pgstatstatements.sgml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,11 +283,11 @@
283283
</row>
284284

285285
<row>
286-
<entry><structfield>wal_fpw</structfield></entry>
286+
<entry><structfield>wal_fpi</structfield></entry>
287287
<entry><type>bigint</type></entry>
288288
<entry></entry>
289289
<entry>
290-
Total number of WAL full pagewrites generated by the statement
290+
Total number of WAL full pageimages generated by the statement
291291
</entry>
292292
</row>
293293

‎doc/src/sgml/ref/explain.sgml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,8 @@ ROLLBACK;
198198
<listitem>
199199
<para>
200200
Include information on WAL record generation. Specifically, include the
201-
number of records, number of full pagewritesand amount of WAL bytes
202-
generated. In text format, only non-zero values are printed. This
201+
number of records, number of full pageimages (fpi)and amount of WAL
202+
bytesgenerated. In text format, only non-zero values are printed. This
203203
parameter may only be used when <literal>ANALYZE</literal> is also
204204
enabled. It defaults to <literal>FALSE</literal>.
205205
</para>

‎src/backend/access/heap/vacuumlazy.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -673,10 +673,10 @@ heap_vacuum_rel(Relation onerel, VacuumParams *params,
673673
read_rate,write_rate);
674674
appendStringInfo(&buf,_("system usage: %s\n"),pg_rusage_show(&ru0));
675675
appendStringInfo(&buf,
676-
_("WAL usage: %ld records, %ld full pagewrites, "
676+
_("WAL usage: %ld records, %ld full pageimages, "
677677
UINT64_FORMAT" bytes"),
678678
walusage.wal_records,
679-
walusage.wal_fpw,
679+
walusage.wal_fpi,
680680
walusage.wal_bytes);
681681

682682
ereport(LOG,

‎src/backend/access/transam/xlog.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -998,7 +998,7 @@ XLogRecPtr
998998
XLogInsertRecord(XLogRecData*rdata,
999999
XLogRecPtrfpw_lsn,
10001000
uint8flags,
1001-
intnum_fpw)
1001+
intnum_fpi)
10021002
{
10031003
XLogCtlInsert*Insert=&XLogCtl->Insert;
10041004
pg_crc32crdata_crc;
@@ -1259,7 +1259,7 @@ XLogInsertRecord(XLogRecData *rdata,
12591259
{
12601260
pgWalUsage.wal_bytes+=rechdr->xl_tot_len;
12611261
pgWalUsage.wal_records++;
1262-
pgWalUsage.wal_fpw+=num_fpw;
1262+
pgWalUsage.wal_fpi+=num_fpi;
12631263
}
12641264

12651265
returnEndPos;

‎src/backend/access/transam/xloginsert.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ static MemoryContext xloginsert_cxt;
109109

110110
staticXLogRecData*XLogRecordAssemble(RmgrIdrmid,uint8info,
111111
XLogRecPtrRedoRecPtr,booldoPageWrites,
112-
XLogRecPtr*fpw_lsn,int*num_fpw);
112+
XLogRecPtr*fpw_lsn,int*num_fpi);
113113
staticboolXLogCompressBackupBlock(char*page,uint16hole_offset,
114114
uint16hole_length,char*dest,uint16*dlen);
115115

@@ -449,7 +449,7 @@ XLogInsert(RmgrId rmid, uint8 info)
449449
booldoPageWrites;
450450
XLogRecPtrfpw_lsn;
451451
XLogRecData*rdt;
452-
intnum_fpw=0;
452+
intnum_fpi=0;
453453

454454
/*
455455
* Get values needed to decide whether to do full-page writes. Since
@@ -459,9 +459,9 @@ XLogInsert(RmgrId rmid, uint8 info)
459459
GetFullPageWriteInfo(&RedoRecPtr,&doPageWrites);
460460

461461
rdt=XLogRecordAssemble(rmid,info,RedoRecPtr,doPageWrites,
462-
&fpw_lsn,&num_fpw);
462+
&fpw_lsn,&num_fpi);
463463

464-
EndPos=XLogInsertRecord(rdt,fpw_lsn,curinsert_flags,num_fpw);
464+
EndPos=XLogInsertRecord(rdt,fpw_lsn,curinsert_flags,num_fpi);
465465
}while (EndPos==InvalidXLogRecPtr);
466466

467467
XLogResetInsertion();
@@ -484,7 +484,7 @@ XLogInsert(RmgrId rmid, uint8 info)
484484
staticXLogRecData*
485485
XLogRecordAssemble(RmgrIdrmid,uint8info,
486486
XLogRecPtrRedoRecPtr,booldoPageWrites,
487-
XLogRecPtr*fpw_lsn,int*num_fpw)
487+
XLogRecPtr*fpw_lsn,int*num_fpi)
488488
{
489489
XLogRecData*rdt;
490490
uint32total_len=0;
@@ -638,7 +638,7 @@ XLogRecordAssemble(RmgrId rmid, uint8 info,
638638
bkpb.fork_flags |=BKPBLOCK_HAS_IMAGE;
639639

640640
/* Report a full page image constructed for the WAL record */
641-
*num_fpw+=1;
641+
*num_fpi+=1;
642642

643643
/*
644644
* Construct XLogRecData entries for the page content.

‎src/backend/commands/explain.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3343,31 +3343,31 @@ show_wal_usage(ExplainState *es, const WalUsage *usage)
33433343
if (es->format==EXPLAIN_FORMAT_TEXT)
33443344
{
33453345
/* Show only positive counter values. */
3346-
if ((usage->wal_records>0)|| (usage->wal_fpw>0)||
3346+
if ((usage->wal_records>0)|| (usage->wal_fpi>0)||
33473347
(usage->wal_bytes>0))
33483348
{
33493349
ExplainIndentText(es);
33503350
appendStringInfoString(es->str,"WAL:");
33513351

33523352
if (usage->wal_records>0)
3353-
appendStringInfo(es->str,"records=%ld",
3353+
appendStringInfo(es->str," records=%ld",
33543354
usage->wal_records);
3355-
if (usage->wal_fpw>0)
3356-
appendStringInfo(es->str," full page writes=%ld",
3357-
usage->wal_fpw);
3355+
if (usage->wal_fpi>0)
3356+
appendStringInfo(es->str,"fpi=%ld",
3357+
usage->wal_fpi);
33583358
if (usage->wal_bytes>0)
3359-
appendStringInfo(es->str,"bytes="UINT64_FORMAT,
3359+
appendStringInfo(es->str," bytes="UINT64_FORMAT,
33603360
usage->wal_bytes);
33613361
appendStringInfoChar(es->str,'\n');
33623362
}
33633363
}
33643364
else
33653365
{
3366-
ExplainPropertyInteger("WALrecords",NULL,
3366+
ExplainPropertyInteger("WALRecords",NULL,
33673367
usage->wal_records,es);
3368-
ExplainPropertyInteger("WALfull page writes",NULL,
3369-
usage->wal_fpw,es);
3370-
ExplainPropertyUInteger("WALbytes",NULL,
3368+
ExplainPropertyInteger("WALFPI",NULL,
3369+
usage->wal_fpi,es);
3370+
ExplainPropertyUInteger("WALBytes",NULL,
33713371
usage->wal_bytes,es);
33723372
}
33733373
}

‎src/backend/executor/instrument.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,13 +248,13 @@ WalUsageAdd(WalUsage *dst, WalUsage *add)
248248
{
249249
dst->wal_bytes+=add->wal_bytes;
250250
dst->wal_records+=add->wal_records;
251-
dst->wal_fpw+=add->wal_fpw;
251+
dst->wal_fpi+=add->wal_fpi;
252252
}
253253

254254
void
255255
WalUsageAccumDiff(WalUsage*dst,constWalUsage*add,constWalUsage*sub)
256256
{
257257
dst->wal_bytes+=add->wal_bytes-sub->wal_bytes;
258258
dst->wal_records+=add->wal_records-sub->wal_records;
259-
dst->wal_fpw+=add->wal_fpw-sub->wal_fpw;
259+
dst->wal_fpi+=add->wal_fpi-sub->wal_fpi;
260260
}

‎src/include/access/xlog.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ struct XLogRecData;
280280
externXLogRecPtrXLogInsertRecord(structXLogRecData*rdata,
281281
XLogRecPtrfpw_lsn,
282282
uint8flags,
283-
intnum_fpw);
283+
intnum_fpi);
284284
externvoidXLogFlush(XLogRecPtrRecPtr);
285285
externboolXLogBackgroundFlush(void);
286286
externboolXLogNeedsFlush(XLogRecPtrRecPtr);

‎src/include/executor/instrument.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ typedef struct BufferUsage
3535
typedefstructWalUsage
3636
{
3737
longwal_records;/* # of WAL records produced */
38-
longwal_fpw;/* # of WAL full pagewrites produced */
38+
longwal_fpi;/* # of WAL full pageimages produced */
3939
uint64wal_bytes;/* size of WAL records produced */
4040
}WalUsage;
4141

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp