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

Commit5147ab1

Browse files
committed
pg_stat_statements: Add local_blk_{read|write}_time
This commit adds to pg_stat_statements the two new fields for localbuffers introduced by295c36c, adding the time spent to read andwrite these blocks. These are similar to what is done for temp andshared blocks. This information available only if track_io_timing isenabled.Like for5a3423a, no version bump is required in the module.Author: Nazir Bilal YavuzReviewed-by: Robert Haas, Melanie PlagemanDiscussion:https://postgr.es/m/CAN55FZ19Ss279mZuqGbuUNxka0iPbLgYuOQXqAKewrjNrp27VA@mail.gmail.com
1 parent295c36c commit5147ab1

File tree

4 files changed

+37
-2
lines changed

4 files changed

+37
-2
lines changed

‎contrib/pg_stat_statements/expected/oldextversions.out

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,8 @@ AlTER EXTENSION pg_stat_statements UPDATE TO '1.11';
286286
temp_blks_written | bigint | | |
287287
shared_blk_read_time | double precision | | |
288288
shared_blk_write_time | double precision | | |
289+
local_blk_read_time | double precision | | |
290+
local_blk_write_time | double precision | | |
289291
temp_blk_read_time | double precision | | |
290292
temp_blk_write_time | double precision | | |
291293
wal_records | bigint | | |

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ CREATE FUNCTION pg_stat_statements(IN showtext boolean,
4343
OUT temp_blks_written int8,
4444
OUT shared_blk_read_time float8,
4545
OUT shared_blk_write_time float8,
46+
OUT local_blk_read_time float8,
47+
OUT local_blk_write_time float8,
4648
OUT temp_blk_read_time float8,
4749
OUT temp_blk_write_time float8,
4850
OUT wal_records int8,

‎contrib/pg_stat_statements/pg_stat_statements.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,10 @@ typedef struct Counters
184184
* in msec */
185185
doubleshared_blk_write_time;/* time spent writing shared blocks,
186186
* in msec */
187+
doublelocal_blk_read_time;/* time spent reading local blocks, in
188+
* msec */
189+
doublelocal_blk_write_time;/* time spent writing local blocks, in
190+
* msec */
187191
doubletemp_blk_read_time;/* time spent reading temp blocks, in msec */
188192
doubletemp_blk_write_time;/* time spent writing temp blocks, in
189193
* msec */
@@ -1395,6 +1399,8 @@ pgss_store(const char *query, uint64 queryId,
13951399
e->counters.temp_blks_written+=bufusage->temp_blks_written;
13961400
e->counters.shared_blk_read_time+=INSTR_TIME_GET_MILLISEC(bufusage->shared_blk_read_time);
13971401
e->counters.shared_blk_write_time+=INSTR_TIME_GET_MILLISEC(bufusage->shared_blk_write_time);
1402+
e->counters.local_blk_read_time+=INSTR_TIME_GET_MILLISEC(bufusage->local_blk_read_time);
1403+
e->counters.local_blk_write_time+=INSTR_TIME_GET_MILLISEC(bufusage->local_blk_write_time);
13981404
e->counters.temp_blk_read_time+=INSTR_TIME_GET_MILLISEC(bufusage->temp_blk_read_time);
13991405
e->counters.temp_blk_write_time+=INSTR_TIME_GET_MILLISEC(bufusage->temp_blk_write_time);
14001406
e->counters.usage+=USAGE_EXEC(total_time);
@@ -1472,8 +1478,8 @@ pg_stat_statements_reset(PG_FUNCTION_ARGS)
14721478
#definePG_STAT_STATEMENTS_COLS_V1_832
14731479
#definePG_STAT_STATEMENTS_COLS_V1_933
14741480
#definePG_STAT_STATEMENTS_COLS_V1_1043
1475-
#definePG_STAT_STATEMENTS_COLS_V1_1145
1476-
#definePG_STAT_STATEMENTS_COLS45/* maximum of above */
1481+
#definePG_STAT_STATEMENTS_COLS_V1_1147
1482+
#definePG_STAT_STATEMENTS_COLS47/* maximum of above */
14771483

14781484
/*
14791485
* Retrieve statement statistics.
@@ -1828,6 +1834,11 @@ pg_stat_statements_internal(FunctionCallInfo fcinfo,
18281834
values[i++]=Float8GetDatumFast(tmp.shared_blk_read_time);
18291835
values[i++]=Float8GetDatumFast(tmp.shared_blk_write_time);
18301836
}
1837+
if (api_version >=PGSS_V1_11)
1838+
{
1839+
values[i++]=Float8GetDatumFast(tmp.local_blk_read_time);
1840+
values[i++]=Float8GetDatumFast(tmp.local_blk_write_time);
1841+
}
18311842
if (api_version >=PGSS_V1_10)
18321843
{
18331844
values[i++]=Float8GetDatumFast(tmp.temp_blk_read_time);

‎doc/src/sgml/pgstatstatements.sgml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,26 @@
353353
</para></entry>
354354
</row>
355355

356+
<row>
357+
<entry role="catalog_table_entry"><para role="column_definition">
358+
<structfield>local_blk_read_time</structfield> <type>double precision</type>
359+
</para>
360+
<para>
361+
Total time the statement spent reading local blocks, in milliseconds
362+
(if <xref linkend="guc-track-io-timing"/> is enabled, otherwise zero)
363+
</para></entry>
364+
</row>
365+
366+
<row>
367+
<entry role="catalog_table_entry"><para role="column_definition">
368+
<structfield>local_blk_write_time</structfield> <type>double precision</type>
369+
</para>
370+
<para>
371+
Total time the statement spent writing local blocks, in milliseconds
372+
(if <xref linkend="guc-track-io-timing"/> is enabled, otherwise zero)
373+
</para></entry>
374+
</row>
375+
356376
<row>
357377
<entry role="catalog_table_entry"><para role="column_definition">
358378
<structfield>temp_blk_read_time</structfield> <type>double precision</type>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp