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

Commitce5bcc4

Browse files
committed
pg_stat_statements: Add wal_buffers_full
wal_buffers_full tracks the number of times WAL buffers become full,giving hints to be able to tune the GUC wal_buffers.Up to now, this information was only available in pg_stat_wal. Withthis field available in WalUsage sinceeaf5027, exposing it inpg_stat_statements is straight-forward, and it offers more granularityat query level.pg_stat_statements does not need a version bump as one has been done incommitcf54a2c for this development cycle.Author: Bertrand DrouvotReviewed-by: Ilia EvdokimovDiscussion:https://postgr.es/m/Z6SOha5YFFgvpwQY@ip-10-97-1-34.eu-west-3.compute.internal
1 parenteaf5027 commitce5bcc4

File tree

4 files changed

+19
-2
lines changed

4 files changed

+19
-2
lines changed

‎contrib/pg_stat_statements/expected/oldextversions.out

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,7 @@ AlTER EXTENSION pg_stat_statements UPDATE TO '1.12';
385385
wal_records | bigint | | |
386386
wal_fpi | bigint | | |
387387
wal_bytes | numeric | | |
388+
wal_buffers_full | bigint | | |
388389
jit_functions | bigint | | |
389390
jit_generation_time | double precision | | |
390391
jit_inlining_count | bigint | | |

‎contrib/pg_stat_statements/pg_stat_statements--1.11--1.12.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ CREATE FUNCTION pg_stat_statements(IN showtext boolean,
5050
OUT wal_records int8,
5151
OUT wal_fpi int8,
5252
OUT wal_bytesnumeric,
53+
OUT wal_buffers_full int8,
5354
OUT jit_functions int8,
5455
OUT jit_generation_time float8,
5556
OUT jit_inlining_count int8,

‎contrib/pg_stat_statements/pg_stat_statements.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ typedef struct Counters
187187
int64wal_records;/* # of WAL records generated */
188188
int64wal_fpi;/* # of WAL full page images generated */
189189
uint64wal_bytes;/* total amount of WAL generated in bytes */
190+
int64wal_buffers_full;/* # of times the WAL buffers became full */
190191
int64jit_functions;/* total number of JIT functions emitted */
191192
doublejit_generation_time;/* total time to generate jit code */
192193
int64jit_inlining_count;/* number of times inlining time has been
@@ -1465,6 +1466,7 @@ pgss_store(const char *query, uint64 queryId,
14651466
entry->counters.wal_records+=walusage->wal_records;
14661467
entry->counters.wal_fpi+=walusage->wal_fpi;
14671468
entry->counters.wal_bytes+=walusage->wal_bytes;
1469+
entry->counters.wal_buffers_full+=walusage->wal_buffers_full;
14681470
if (jitusage)
14691471
{
14701472
entry->counters.jit_functions+=jitusage->created_functions;
@@ -1557,8 +1559,8 @@ pg_stat_statements_reset(PG_FUNCTION_ARGS)
15571559
#definePG_STAT_STATEMENTS_COLS_V1_933
15581560
#definePG_STAT_STATEMENTS_COLS_V1_1043
15591561
#definePG_STAT_STATEMENTS_COLS_V1_1149
1560-
#definePG_STAT_STATEMENTS_COLS_V1_1251
1561-
#definePG_STAT_STATEMENTS_COLS51/* maximum of above */
1562+
#definePG_STAT_STATEMENTS_COLS_V1_1252
1563+
#definePG_STAT_STATEMENTS_COLS52/* maximum of above */
15621564

15631565
/*
15641566
* Retrieve statement statistics.
@@ -1955,6 +1957,10 @@ pg_stat_statements_internal(FunctionCallInfo fcinfo,
19551957
Int32GetDatum(-1));
19561958
values[i++]=wal_bytes;
19571959
}
1960+
if (api_version >=PGSS_V1_12)
1961+
{
1962+
values[i++]=Int64GetDatumFast(tmp.wal_buffers_full);
1963+
}
19581964
if (api_version >=PGSS_V1_10)
19591965
{
19601966
values[i++]=Int64GetDatumFast(tmp.jit_functions);

‎doc/src/sgml/pgstatstatements.sgml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,15 @@
436436
</para></entry>
437437
</row>
438438

439+
<row>
440+
<entry role="catalog_table_entry"><para role="column_definition">
441+
<structfield>wal_buffers_full</structfield> <type>bigint</type>
442+
</para>
443+
<para>
444+
Number of times the WAL buffers became full
445+
</para></entry>
446+
</row>
447+
439448
<row>
440449
<entry role="catalog_table_entry"><para role="column_definition">
441450
<structfield>jit_functions</structfield> <type>bigint</type>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp