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

Commit13d0072

Browse files
committed
Rename I/O timing statistics columns to shared_blk_{read|write}_time
These two counters, defined in BufferUsage to track respectively thetime spent while reading and writing blocks have historically onlytracked data related to shared buffers, when track_io_timing is enabled.An upcoming patch to add specific counters for local buffers will takeadvantage of this rename as it has come up that no data is currentlytracked for local buffers, and tracking local and shared buffers usingthe same fields would be inconsistent with the treatment done for tempbuffers. Renaming the existing fields clarifies what the block type ofeach stats field is.pg_stat_statement is updated to reflect the rename. No extensionversion bump is required as5a3423a has done one, affecting v17~.Author: Nazir Bilal YavuzReviewed-by: Robert Haas, Melanie PlagemanDiscussion:https://postgr.es/m/CAN55FZ19Ss279mZuqGbuUNxka0iPbLgYuOQXqAKewrjNrp27VA@mail.gmail.com
1 parent9b103f8 commit13d0072

File tree

9 files changed

+95
-92
lines changed

9 files changed

+95
-92
lines changed

‎contrib/pg_stat_statements/expected/oldextversions.out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,8 @@ AlTER EXTENSION pg_stat_statements UPDATE TO '1.11';
284284
local_blks_written | bigint | | |
285285
temp_blks_read | bigint | | |
286286
temp_blks_written | bigint | | |
287-
blk_read_time | double precision | | |
288-
blk_write_time | double precision | | |
287+
shared_blk_read_time | double precision | | |
288+
shared_blk_write_time | double precision | | |
289289
temp_blk_read_time | double precision | | |
290290
temp_blk_write_time | double precision | | |
291291
wal_records | bigint | | |

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ CREATE FUNCTION pg_stat_statements(IN showtext boolean,
4141
OUT local_blks_written int8,
4242
OUT temp_blks_read int8,
4343
OUT temp_blks_written int8,
44-
OUTblk_read_time float8,
45-
OUTblk_write_time float8,
44+
OUTshared_blk_read_time float8,
45+
OUTshared_blk_write_time float8,
4646
OUT temp_blk_read_time float8,
4747
OUT temp_blk_write_time float8,
4848
OUT wal_records int8,

‎contrib/pg_stat_statements/pg_stat_statements.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,10 @@ typedef struct Counters
180180
int64local_blks_written;/* # of local disk blocks written */
181181
int64temp_blks_read;/* # of temp blocks read */
182182
int64temp_blks_written;/* # of temp blocks written */
183-
doubleblk_read_time;/* time spent reading blocks, in msec */
184-
doubleblk_write_time;/* time spent writing blocks, in msec */
183+
doubleshared_blk_read_time;/* time spent reading shared blocks,
184+
* in msec */
185+
doubleshared_blk_write_time;/* time spent writing shared blocks,
186+
* in msec */
185187
doubletemp_blk_read_time;/* time spent reading temp blocks, in msec */
186188
doubletemp_blk_write_time;/* time spent writing temp blocks, in
187189
* msec */
@@ -1391,8 +1393,8 @@ pgss_store(const char *query, uint64 queryId,
13911393
e->counters.local_blks_written+=bufusage->local_blks_written;
13921394
e->counters.temp_blks_read+=bufusage->temp_blks_read;
13931395
e->counters.temp_blks_written+=bufusage->temp_blks_written;
1394-
e->counters.blk_read_time+=INSTR_TIME_GET_MILLISEC(bufusage->blk_read_time);
1395-
e->counters.blk_write_time+=INSTR_TIME_GET_MILLISEC(bufusage->blk_write_time);
1396+
e->counters.shared_blk_read_time+=INSTR_TIME_GET_MILLISEC(bufusage->shared_blk_read_time);
1397+
e->counters.shared_blk_write_time+=INSTR_TIME_GET_MILLISEC(bufusage->shared_blk_write_time);
13961398
e->counters.temp_blk_read_time+=INSTR_TIME_GET_MILLISEC(bufusage->temp_blk_read_time);
13971399
e->counters.temp_blk_write_time+=INSTR_TIME_GET_MILLISEC(bufusage->temp_blk_write_time);
13981400
e->counters.usage+=USAGE_EXEC(total_time);
@@ -1823,8 +1825,8 @@ pg_stat_statements_internal(FunctionCallInfo fcinfo,
18231825
values[i++]=Int64GetDatumFast(tmp.temp_blks_written);
18241826
if (api_version >=PGSS_V1_1)
18251827
{
1826-
values[i++]=Float8GetDatumFast(tmp.blk_read_time);
1827-
values[i++]=Float8GetDatumFast(tmp.blk_write_time);
1828+
values[i++]=Float8GetDatumFast(tmp.shared_blk_read_time);
1829+
values[i++]=Float8GetDatumFast(tmp.shared_blk_write_time);
18281830
}
18291831
if (api_version >=PGSS_V1_10)
18301832
{

‎doc/src/sgml/pgstatstatements.sgml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -335,20 +335,20 @@
335335

336336
<row>
337337
<entry role="catalog_table_entry"><para role="column_definition">
338-
<structfield>blk_read_time</structfield> <type>double precision</type>
338+
<structfield>shared_blk_read_time</structfield> <type>double precision</type>
339339
</para>
340340
<para>
341-
Total time the statement spent readingdata file blocks, in milliseconds
341+
Total time the statement spent readingshared blocks, in milliseconds
342342
(if <xref linkend="guc-track-io-timing"/> is enabled, otherwise zero)
343343
</para></entry>
344344
</row>
345345

346346
<row>
347347
<entry role="catalog_table_entry"><para role="column_definition">
348-
<structfield>blk_write_time</structfield> <type>double precision</type>
348+
<structfield>shared_blk_write_time</structfield> <type>double precision</type>
349349
</para>
350350
<para>
351-
Total time the statement spent writingdata file blocks, in milliseconds
351+
Total time the statement spent writingshared blocks, in milliseconds
352352
(if <xref linkend="guc-track-io-timing"/> is enabled, otherwise zero)
353353
</para></entry>
354354
</row>

‎src/backend/commands/explain.c

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3562,12 +3562,13 @@ show_buffer_usage(ExplainState *es, const BufferUsage *usage, bool planning)
35623562
usage->local_blks_written>0);
35633563
boolhas_temp= (usage->temp_blks_read>0||
35643564
usage->temp_blks_written>0);
3565-
boolhas_timing= (!INSTR_TIME_IS_ZERO(usage->blk_read_time)||
3566-
!INSTR_TIME_IS_ZERO(usage->blk_write_time));
3565+
boolhas_shared_timing= (!INSTR_TIME_IS_ZERO(usage->shared_blk_read_time)||
3566+
!INSTR_TIME_IS_ZERO(usage->shared_blk_write_time));
35673567
boolhas_temp_timing= (!INSTR_TIME_IS_ZERO(usage->temp_blk_read_time)||
35683568
!INSTR_TIME_IS_ZERO(usage->temp_blk_write_time));
35693569
boolshow_planning= (planning&& (has_shared||
3570-
has_local||has_temp||has_timing||
3570+
has_local||has_temp||
3571+
has_shared_timing||
35713572
has_temp_timing));
35723573

35733574
if (show_planning)
@@ -3633,20 +3634,20 @@ show_buffer_usage(ExplainState *es, const BufferUsage *usage, bool planning)
36333634
}
36343635

36353636
/* As above, show only positive counter values. */
3636-
if (has_timing||has_temp_timing)
3637+
if (has_shared_timing||has_temp_timing)
36373638
{
36383639
ExplainIndentText(es);
36393640
appendStringInfoString(es->str,"I/O Timings:");
36403641

3641-
if (has_timing)
3642+
if (has_shared_timing)
36423643
{
3643-
appendStringInfoString(es->str," shared/local");
3644-
if (!INSTR_TIME_IS_ZERO(usage->blk_read_time))
3644+
appendStringInfoString(es->str," shared");
3645+
if (!INSTR_TIME_IS_ZERO(usage->shared_blk_read_time))
36453646
appendStringInfo(es->str," read=%0.3f",
3646-
INSTR_TIME_GET_MILLISEC(usage->blk_read_time));
3647-
if (!INSTR_TIME_IS_ZERO(usage->blk_write_time))
3647+
INSTR_TIME_GET_MILLISEC(usage->shared_blk_read_time));
3648+
if (!INSTR_TIME_IS_ZERO(usage->shared_blk_write_time))
36483649
appendStringInfo(es->str," write=%0.3f",
3649-
INSTR_TIME_GET_MILLISEC(usage->blk_write_time));
3650+
INSTR_TIME_GET_MILLISEC(usage->shared_blk_write_time));
36503651
if (has_temp_timing)
36513652
appendStringInfoChar(es->str,',');
36523653
}
@@ -3690,11 +3691,11 @@ show_buffer_usage(ExplainState *es, const BufferUsage *usage, bool planning)
36903691
usage->temp_blks_written,es);
36913692
if (track_io_timing)
36923693
{
3693-
ExplainPropertyFloat("I/O Read Time","ms",
3694-
INSTR_TIME_GET_MILLISEC(usage->blk_read_time),
3694+
ExplainPropertyFloat("SharedI/O Read Time","ms",
3695+
INSTR_TIME_GET_MILLISEC(usage->shared_blk_read_time),
36953696
3,es);
3696-
ExplainPropertyFloat("I/O Write Time","ms",
3697-
INSTR_TIME_GET_MILLISEC(usage->blk_write_time),
3697+
ExplainPropertyFloat("SharedI/O Write Time","ms",
3698+
INSTR_TIME_GET_MILLISEC(usage->shared_blk_write_time),
36983699
3,es);
36993700
ExplainPropertyFloat("Temp I/O Read Time","ms",
37003701
INSTR_TIME_GET_MILLISEC(usage->temp_blk_read_time),

‎src/backend/executor/instrument.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,8 @@ BufferUsageAdd(BufferUsage *dst, const BufferUsage *add)
235235
dst->local_blks_written+=add->local_blks_written;
236236
dst->temp_blks_read+=add->temp_blks_read;
237237
dst->temp_blks_written+=add->temp_blks_written;
238-
INSTR_TIME_ADD(dst->blk_read_time,add->blk_read_time);
239-
INSTR_TIME_ADD(dst->blk_write_time,add->blk_write_time);
238+
INSTR_TIME_ADD(dst->shared_blk_read_time,add->shared_blk_read_time);
239+
INSTR_TIME_ADD(dst->shared_blk_write_time,add->shared_blk_write_time);
240240
INSTR_TIME_ADD(dst->temp_blk_read_time,add->temp_blk_read_time);
241241
INSTR_TIME_ADD(dst->temp_blk_write_time,add->temp_blk_write_time);
242242
}
@@ -257,10 +257,10 @@ BufferUsageAccumDiff(BufferUsage *dst,
257257
dst->local_blks_written+=add->local_blks_written-sub->local_blks_written;
258258
dst->temp_blks_read+=add->temp_blks_read-sub->temp_blks_read;
259259
dst->temp_blks_written+=add->temp_blks_written-sub->temp_blks_written;
260-
INSTR_TIME_ACCUM_DIFF(dst->blk_read_time,
261-
add->blk_read_time,sub->blk_read_time);
262-
INSTR_TIME_ACCUM_DIFF(dst->blk_write_time,
263-
add->blk_write_time,sub->blk_write_time);
260+
INSTR_TIME_ACCUM_DIFF(dst->shared_blk_read_time,
261+
add->shared_blk_read_time,sub->shared_blk_read_time);
262+
INSTR_TIME_ACCUM_DIFF(dst->shared_blk_write_time,
263+
add->shared_blk_write_time,sub->shared_blk_write_time);
264264
INSTR_TIME_ACCUM_DIFF(dst->temp_blk_read_time,
265265
add->temp_blk_read_time,sub->temp_blk_read_time);
266266
INSTR_TIME_ACCUM_DIFF(dst->temp_blk_write_time,

‎src/backend/utils/activity/pgstat_io.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,13 @@ pgstat_count_io_op_time(IOObject io_object, IOContext io_context, IOOp io_op,
123123
{
124124
pgstat_count_buffer_write_time(INSTR_TIME_GET_MICROSEC(io_time));
125125
if (io_object==IOOBJECT_RELATION)
126-
INSTR_TIME_ADD(pgBufferUsage.blk_write_time,io_time);
126+
INSTR_TIME_ADD(pgBufferUsage.shared_blk_write_time,io_time);
127127
}
128128
elseif (io_op==IOOP_READ)
129129
{
130130
pgstat_count_buffer_read_time(INSTR_TIME_GET_MICROSEC(io_time));
131131
if (io_object==IOOBJECT_RELATION)
132-
INSTR_TIME_ADD(pgBufferUsage.blk_read_time,io_time);
132+
INSTR_TIME_ADD(pgBufferUsage.shared_blk_read_time,io_time);
133133
}
134134

135135
INSTR_TIME_ADD(PendingIOStats.pending_times[io_object][io_context][io_op],

‎src/include/executor/instrument.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ typedef struct BufferUsage
3333
int64local_blks_written;/* # of local disk blocks written */
3434
int64temp_blks_read;/* # of temp blocks read */
3535
int64temp_blks_written;/* # of temp blocks written */
36-
instr_timeblk_read_time;/* time spent reading blocks */
37-
instr_timeblk_write_time;/* time spent writing blocks */
36+
instr_timeshared_blk_read_time;/* time spent reading shared blocks */
37+
instr_timeshared_blk_write_time;/* time spent writing shared blocks */
3838
instr_timetemp_blk_read_time;/* time spent reading temp blocks */
3939
instr_timetemp_blk_write_time;/* time spent writing temp blocks */
4040
}BufferUsage;

‎src/test/regress/expected/explain.out

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -230,60 +230,60 @@ select explain_filter('explain (buffers, format json) select * from int8_tbl i8'
230230
-- but always set in JSON format, so check them only in this case.
231231
set track_io_timing = on;
232232
select explain_filter('explain (analyze, buffers, format json) select * from int8_tbl i8');
233-
explain_filter
234-
------------------------------------
235-
[ +
236-
{ +
237-
"Plan": { +
238-
"Node Type": "Seq Scan", +
239-
"Parallel Aware": false, +
240-
"Async Capable": false, +
241-
"Relation Name": "int8_tbl",+
242-
"Alias": "i8", +
243-
"Startup Cost": N.N, +
244-
"Total Cost": N.N, +
245-
"Plan Rows": N, +
246-
"Plan Width": N, +
247-
"Actual Startup Time": N.N, +
248-
"Actual Total Time": N.N, +
249-
"Actual Rows": N, +
250-
"Actual Loops": N, +
251-
"Shared Hit Blocks": N, +
252-
"Shared Read Blocks": N, +
253-
"Shared Dirtied Blocks": N, +
254-
"Shared Written Blocks": N, +
255-
"Local Hit Blocks": N, +
256-
"Local Read Blocks": N, +
257-
"Local Dirtied Blocks": N, +
258-
"Local Written Blocks": N, +
259-
"Temp Read Blocks": N, +
260-
"Temp Written Blocks": N, +
261-
"I/O Read Time": N.N, +
262-
"I/O Write Time": N.N,+
263-
"Temp I/O Read Time": N.N, +
264-
"Temp I/O Write Time": N.N +
265-
}, +
266-
"Planning": { +
267-
"Shared Hit Blocks": N, +
268-
"Shared Read Blocks": N, +
269-
"Shared Dirtied Blocks": N, +
270-
"Shared Written Blocks": N, +
271-
"Local Hit Blocks": N, +
272-
"Local Read Blocks": N, +
273-
"Local Dirtied Blocks": N, +
274-
"Local Written Blocks": N, +
275-
"Temp Read Blocks": N, +
276-
"Temp Written Blocks": N, +
277-
"I/O Read Time": N.N, +
278-
"I/O Write Time": N.N,+
279-
"Temp I/O Read Time": N.N, +
280-
"Temp I/O Write Time": N.N +
281-
}, +
282-
"Planning Time": N.N, +
283-
"Triggers": [ +
284-
], +
285-
"Execution Time": N.N +
286-
} +
233+
explain_filter
234+
-------------------------------------
235+
[+
236+
{+
237+
"Plan": {+
238+
"Node Type": "Seq Scan",+
239+
"Parallel Aware": false,+
240+
"Async Capable": false,+
241+
"Relation Name": "int8_tbl",+
242+
"Alias": "i8",+
243+
"Startup Cost": N.N,+
244+
"Total Cost": N.N,+
245+
"Plan Rows": N,+
246+
"Plan Width": N,+
247+
"Actual Startup Time": N.N,+
248+
"Actual Total Time": N.N,+
249+
"Actual Rows": N,+
250+
"Actual Loops": N,+
251+
"Shared Hit Blocks": N,+
252+
"Shared Read Blocks": N,+
253+
"Shared Dirtied Blocks": N,+
254+
"Shared Written Blocks": N,+
255+
"Local Hit Blocks": N,+
256+
"Local Read Blocks": N,+
257+
"Local Dirtied Blocks": N,+
258+
"Local Written Blocks": N,+
259+
"Temp Read Blocks": N,+
260+
"Temp Written Blocks": N,+
261+
"SharedI/O Read Time": N.N, +
262+
"SharedI/O Write Time": N.N,+
263+
"Temp I/O Read Time": N.N,+
264+
"Temp I/O Write Time": N.N+
265+
},+
266+
"Planning": {+
267+
"Shared Hit Blocks": N,+
268+
"Shared Read Blocks": N,+
269+
"Shared Dirtied Blocks": N,+
270+
"Shared Written Blocks": N,+
271+
"Local Hit Blocks": N,+
272+
"Local Read Blocks": N,+
273+
"Local Dirtied Blocks": N,+
274+
"Local Written Blocks": N,+
275+
"Temp Read Blocks": N,+
276+
"Temp Written Blocks": N,+
277+
"SharedI/O Read Time": N.N, +
278+
"SharedI/O Write Time": N.N,+
279+
"Temp I/O Read Time": N.N,+
280+
"Temp I/O Write Time": N.N+
281+
},+
282+
"Planning Time": N.N,+
283+
"Triggers": [+
284+
],+
285+
"Execution Time": N.N+
286+
}+
287287
]
288288
(1 row)
289289

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp