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

Commit1dd89ea

Browse files
committed
Rename I/O timing statistics columns to blk_read_time and blk_write_time.
This seems more consistent with the pre-existing choices for names ofother statistics columns. Rename assorted internal identifiers to match.
1 parent309c647 commit1dd89ea

File tree

16 files changed

+79
-79
lines changed

16 files changed

+79
-79
lines changed

‎contrib/pg_stat_statements/pg_stat_statements--1.0--1.1.sql‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ CREATE FUNCTION pg_stat_statements(
2929
OUT local_blks_written int8,
3030
OUT temp_blks_read int8,
3131
OUT temp_blks_written int8,
32-
OUTtime_read float8,
33-
OUTtime_write float8
32+
OUTblk_read_time float8,
33+
OUTblk_write_time float8
3434
)
3535
RETURNS SETOF record
3636
AS'MODULE_PATHNAME'

‎contrib/pg_stat_statements/pg_stat_statements--1.1.sql‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ CREATE FUNCTION pg_stat_statements(
2626
OUT local_blks_written int8,
2727
OUT temp_blks_read int8,
2828
OUT temp_blks_written int8,
29-
OUTtime_read float8,
30-
OUTtime_write float8
29+
OUTblk_read_time float8,
30+
OUTblk_write_time float8
3131
)
3232
RETURNS SETOF record
3333
AS'MODULE_PATHNAME'

‎contrib/pg_stat_statements/pg_stat_statements.c‎

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -103,19 +103,19 @@ typedef struct Counters
103103
int64calls;/* # of times executed */
104104
doubletotal_time;/* total execution time, in msec */
105105
int64rows;/* total # of retrieved or affected rows */
106-
int64shared_blks_hit;/* # of shared buffer hits */
106+
int64shared_blks_hit;/* # of shared buffer hits */
107107
int64shared_blks_read;/* # of shared disk blocks read */
108108
int64shared_blks_dirtied;/* # of shared disk blocks dirtied */
109109
int64shared_blks_written;/* # of shared disk blocks written */
110-
int64local_blks_hit;/* # of local buffer hits */
111-
int64local_blks_read;/* # of local disk blocks read */
110+
int64local_blks_hit;/* # of local buffer hits */
111+
int64local_blks_read;/* # of local disk blocks read */
112112
int64local_blks_dirtied;/* # of local disk blocks dirtied */
113113
int64local_blks_written;/* # of local disk blocks written */
114-
int64temp_blks_read;/* # of temp blocks read */
114+
int64temp_blks_read;/* # of temp blocks read */
115115
int64temp_blks_written;/* # of temp blocks written */
116-
doubletime_read;/* time spent reading, in msec */
117-
doubletime_write;/* time spent writing, in msec */
118-
doubleusage;/* usage factor */
116+
doubleblk_read_time;/* time spent reading, in msec */
117+
doubleblk_write_time;/* time spent writing, in msec */
118+
doubleusage;/* usage factor */
119119
}Counters;
120120

121121
/*
@@ -846,10 +846,10 @@ pgss_ProcessUtility(Node *parsetree, const char *queryString,
846846
pgBufferUsage.temp_blks_read-bufusage_start.temp_blks_read;
847847
bufusage.temp_blks_written=
848848
pgBufferUsage.temp_blks_written-bufusage_start.temp_blks_written;
849-
bufusage.time_read=pgBufferUsage.time_read;
850-
INSTR_TIME_SUBTRACT(bufusage.time_read,bufusage_start.time_read);
851-
bufusage.time_write=pgBufferUsage.time_write;
852-
INSTR_TIME_SUBTRACT(bufusage.time_write,bufusage_start.time_write);
849+
bufusage.blk_read_time=pgBufferUsage.blk_read_time;
850+
INSTR_TIME_SUBTRACT(bufusage.blk_read_time,bufusage_start.blk_read_time);
851+
bufusage.blk_write_time=pgBufferUsage.blk_write_time;
852+
INSTR_TIME_SUBTRACT(bufusage.blk_write_time,bufusage_start.blk_write_time);
853853

854854
/* For utility statements, we just hash the query string directly */
855855
queryId=pgss_hash_string(queryString);
@@ -1021,8 +1021,8 @@ pgss_store(const char *query, uint32 queryId,
10211021
e->counters.local_blks_written+=bufusage->local_blks_written;
10221022
e->counters.temp_blks_read+=bufusage->temp_blks_read;
10231023
e->counters.temp_blks_written+=bufusage->temp_blks_written;
1024-
e->counters.time_read+=INSTR_TIME_GET_MILLISEC(bufusage->time_read);
1025-
e->counters.time_write+=INSTR_TIME_GET_MILLISEC(bufusage->time_write);
1024+
e->counters.blk_read_time+=INSTR_TIME_GET_MILLISEC(bufusage->blk_read_time);
1025+
e->counters.blk_write_time+=INSTR_TIME_GET_MILLISEC(bufusage->blk_write_time);
10261026
e->counters.usage+=USAGE_EXEC(total_time);
10271027

10281028
SpinLockRelease(&e->mutex);
@@ -1163,8 +1163,8 @@ pg_stat_statements(PG_FUNCTION_ARGS)
11631163
values[i++]=Int64GetDatumFast(tmp.temp_blks_written);
11641164
if (sql_supports_v1_1_counters)
11651165
{
1166-
values[i++]=Float8GetDatumFast(tmp.time_read);
1167-
values[i++]=Float8GetDatumFast(tmp.time_write);
1166+
values[i++]=Float8GetDatumFast(tmp.blk_read_time);
1167+
values[i++]=Float8GetDatumFast(tmp.blk_write_time);
11681168
}
11691169

11701170
Assert(i== (sql_supports_v1_1_counters ?

‎doc/src/sgml/monitoring.sgml‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -839,13 +839,13 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re
839839
<entry>Number of deadlocks detected in this database</entry>
840840
</row>
841841
<row>
842-
<entry><structfield>block_read_time</></entry>
842+
<entry><structfield>blk_read_time</></entry>
843843
<entry><type>bigint</></entry>
844844
<entry>Time spent reading data file blocks by backends in this database,
845845
in milliseconds</entry>
846846
</row>
847847
<row>
848-
<entry><structfield>block_write_time</></entry>
848+
<entry><structfield>blk_write_time</></entry>
849849
<entry><type>bigint</></entry>
850850
<entry>Time spent writing data file blocks by backends in this database,
851851
in milliseconds</entry>
@@ -1709,8 +1709,6 @@ SELECT pg_stat_get_backend_pid(s.backendid) AS pid,
17091709
<entry><literal><function>pg_stat_get_backend_start(integer)</function></literal></entry>
17101710
<entry><type>timestamp with time zone</type></entry>
17111711
<entry>Time when this process was started</entry>
1712-
<entry>
1713-
</entry>
17141712
</row>
17151713

17161714
<row>

‎doc/src/sgml/pgstatstatements.sgml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@
156156
</row>
157157

158158
<row>
159-
<entry><structfield>time_read</structfield></entry>
159+
<entry><structfield>blk_read_time</structfield></entry>
160160
<entry><type>double precision</type></entry>
161161
<entry></entry>
162162
<entry>
@@ -166,7 +166,7 @@
166166
</row>
167167

168168
<row>
169-
<entry><structfield>time_write</structfield></entry>
169+
<entry><structfield>blk_write_time</structfield></entry>
170170
<entry><type>double precision</type></entry>
171171
<entry></entry>
172172
<entry>

‎src/backend/catalog/system_views.sql‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -604,8 +604,8 @@ CREATE VIEW pg_stat_database AS
604604
pg_stat_get_db_temp_files(D.oid)AS temp_files,
605605
pg_stat_get_db_temp_bytes(D.oid)AS temp_bytes,
606606
pg_stat_get_db_deadlocks(D.oid)AS deadlocks,
607-
pg_stat_get_db_block_time_read(D.oid)/1000ASblock_read_time,
608-
pg_stat_get_db_block_time_write(D.oid)/1000ASblock_write_time,
607+
pg_stat_get_db_blk_read_time(D.oid)/1000ASblk_read_time,
608+
pg_stat_get_db_blk_write_time(D.oid)/1000ASblk_write_time,
609609
pg_stat_get_db_stat_reset_time(D.oid)AS stats_reset
610610
FROM pg_database D;
611611

‎src/backend/commands/explain.c‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,8 +1236,8 @@ ExplainNode(PlanState *planstate, List *ancestors,
12361236
usage->local_blks_written>0);
12371237
boolhas_temp= (usage->temp_blks_read>0||
12381238
usage->temp_blks_written>0);
1239-
boolhas_timing= (!INSTR_TIME_IS_ZERO(usage->time_read)||
1240-
!INSTR_TIME_IS_ZERO(usage->time_write));
1239+
boolhas_timing= (!INSTR_TIME_IS_ZERO(usage->blk_read_time)||
1240+
!INSTR_TIME_IS_ZERO(usage->blk_write_time));
12411241

12421242
/* Show only positive counter values. */
12431243
if (has_shared||has_local||has_temp)
@@ -1299,12 +1299,12 @@ ExplainNode(PlanState *planstate, List *ancestors,
12991299
{
13001300
appendStringInfoSpaces(es->str,es->indent*2);
13011301
appendStringInfoString(es->str,"I/O Timings:");
1302-
if (!INSTR_TIME_IS_ZERO(usage->time_read))
1303-
appendStringInfo(es->str," read=%0.2f",
1304-
INSTR_TIME_GET_MILLISEC(usage->time_read));
1305-
if (!INSTR_TIME_IS_ZERO(usage->time_write))
1306-
appendStringInfo(es->str," write=%0.2f",
1307-
INSTR_TIME_GET_MILLISEC(usage->time_write));
1302+
if (!INSTR_TIME_IS_ZERO(usage->blk_read_time))
1303+
appendStringInfo(es->str," read=%0.3f",
1304+
INSTR_TIME_GET_MILLISEC(usage->blk_read_time));
1305+
if (!INSTR_TIME_IS_ZERO(usage->blk_write_time))
1306+
appendStringInfo(es->str," write=%0.3f",
1307+
INSTR_TIME_GET_MILLISEC(usage->blk_write_time));
13081308
appendStringInfoChar(es->str,'\n');
13091309
}
13101310
}
@@ -1320,8 +1320,8 @@ ExplainNode(PlanState *planstate, List *ancestors,
13201320
ExplainPropertyLong("Local Written Blocks",usage->local_blks_written,es);
13211321
ExplainPropertyLong("Temp Read Blocks",usage->temp_blks_read,es);
13221322
ExplainPropertyLong("Temp Written Blocks",usage->temp_blks_written,es);
1323-
ExplainPropertyFloat("I/O Read Time",INSTR_TIME_GET_MILLISEC(usage->time_read),3,es);
1324-
ExplainPropertyFloat("I/O Write Time",INSTR_TIME_GET_MILLISEC(usage->time_write),3,es);
1323+
ExplainPropertyFloat("I/O Read Time",INSTR_TIME_GET_MILLISEC(usage->blk_read_time),3,es);
1324+
ExplainPropertyFloat("I/O Write Time",INSTR_TIME_GET_MILLISEC(usage->blk_write_time),3,es);
13251325
}
13261326
}
13271327

‎src/backend/executor/instrument.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ BufferUsageAccumDiff(BufferUsage *dst,
145145
dst->local_blks_written+=add->local_blks_written-sub->local_blks_written;
146146
dst->temp_blks_read+=add->temp_blks_read-sub->temp_blks_read;
147147
dst->temp_blks_written+=add->temp_blks_written-sub->temp_blks_written;
148-
INSTR_TIME_ACCUM_DIFF(dst->time_read,add->time_read,sub->time_read);
149-
INSTR_TIME_ACCUM_DIFF(dst->time_write,add->time_write,sub->time_write);
148+
INSTR_TIME_ACCUM_DIFF(dst->blk_read_time,
149+
add->blk_read_time,sub->blk_read_time);
150+
INSTR_TIME_ACCUM_DIFF(dst->blk_write_time,
151+
add->blk_write_time,sub->blk_write_time);
150152
}

‎src/backend/postmaster/pgstat.c‎

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,8 @@ static PgStat_SubXactStatus *pgStatXactStack = NULL;
197197

198198
staticintpgStatXactCommit=0;
199199
staticintpgStatXactRollback=0;
200-
PgStat_CounterpgStatBlockTimeRead=0;
201-
PgStat_CounterpgStatBlockTimeWrite=0;
200+
PgStat_CounterpgStatBlockReadTime=0;
201+
PgStat_CounterpgStatBlockWriteTime=0;
202202

203203
/* Record that's written to 2PC state file when pgstat state is persisted */
204204
typedefstructTwoPhasePgStatRecord
@@ -791,19 +791,19 @@ pgstat_send_tabstat(PgStat_MsgTabstat *tsmsg)
791791
{
792792
tsmsg->m_xact_commit=pgStatXactCommit;
793793
tsmsg->m_xact_rollback=pgStatXactRollback;
794-
tsmsg->m_block_time_read=pgStatBlockTimeRead;
795-
tsmsg->m_block_time_write=pgStatBlockTimeWrite;
794+
tsmsg->m_block_read_time=pgStatBlockReadTime;
795+
tsmsg->m_block_write_time=pgStatBlockWriteTime;
796796
pgStatXactCommit=0;
797797
pgStatXactRollback=0;
798-
pgStatBlockTimeRead=0;
799-
pgStatBlockTimeWrite=0;
798+
pgStatBlockReadTime=0;
799+
pgStatBlockWriteTime=0;
800800
}
801801
else
802802
{
803803
tsmsg->m_xact_commit=0;
804804
tsmsg->m_xact_rollback=0;
805-
tsmsg->m_block_time_read=0;
806-
tsmsg->m_block_time_write=0;
805+
tsmsg->m_block_read_time=0;
806+
tsmsg->m_block_write_time=0;
807807
}
808808

809809
n=tsmsg->m_nentries;
@@ -3360,8 +3360,8 @@ pgstat_get_db_entry(Oid databaseid, bool create)
33603360
result->n_temp_files=0;
33613361
result->n_temp_bytes=0;
33623362
result->n_deadlocks=0;
3363-
result->n_block_time_read=0;
3364-
result->n_block_time_write=0;
3363+
result->n_block_read_time=0;
3364+
result->n_block_write_time=0;
33653365

33663366
result->stat_reset_timestamp=GetCurrentTimestamp();
33673367

@@ -4080,8 +4080,8 @@ pgstat_recv_tabstat(PgStat_MsgTabstat *msg, int len)
40804080
*/
40814081
dbentry->n_xact_commit+= (PgStat_Counter) (msg->m_xact_commit);
40824082
dbentry->n_xact_rollback+= (PgStat_Counter) (msg->m_xact_rollback);
4083-
dbentry->n_block_time_read+=msg->m_block_time_read;
4084-
dbentry->n_block_time_write+=msg->m_block_time_write;
4083+
dbentry->n_block_read_time+=msg->m_block_read_time;
4084+
dbentry->n_block_write_time+=msg->m_block_write_time;
40854085

40864086
/*
40874087
* Process all table entries in the message.
@@ -4278,8 +4278,8 @@ pgstat_recv_resetcounter(PgStat_MsgResetcounter *msg, int len)
42784278
dbentry->n_temp_bytes=0;
42794279
dbentry->n_temp_files=0;
42804280
dbentry->n_deadlocks=0;
4281-
dbentry->n_block_time_read=0;
4282-
dbentry->n_block_time_write=0;
4281+
dbentry->n_block_read_time=0;
4282+
dbentry->n_block_write_time=0;
42834283

42844284
dbentry->stat_reset_timestamp=GetCurrentTimestamp();
42854285

‎src/backend/storage/buffer/bufmgr.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum,
451451
INSTR_TIME_SET_CURRENT(io_time);
452452
INSTR_TIME_SUBTRACT(io_time,io_start);
453453
pgstat_count_buffer_read_time(INSTR_TIME_GET_MICROSEC(io_time));
454-
INSTR_TIME_ADD(pgBufferUsage.time_read,io_time);
454+
INSTR_TIME_ADD(pgBufferUsage.blk_read_time,io_time);
455455
}
456456

457457
/* check for garbage data */
@@ -1952,7 +1952,7 @@ FlushBuffer(volatile BufferDesc *buf, SMgrRelation reln)
19521952
INSTR_TIME_SET_CURRENT(io_time);
19531953
INSTR_TIME_SUBTRACT(io_time,io_start);
19541954
pgstat_count_buffer_write_time(INSTR_TIME_GET_MICROSEC(io_time));
1955-
INSTR_TIME_ADD(pgBufferUsage.time_write,io_time);
1955+
INSTR_TIME_ADD(pgBufferUsage.blk_write_time,io_time);
19561956
}
19571957

19581958
pgBufferUsage.shared_blks_written++;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp