diff options
author | Michael Paquier <michael@paquier.xyz> | 2023-10-19 11:26:40 +0900 |
---|---|---|
committer | Michael Paquier <michael@paquier.xyz> | 2023-10-19 11:26:40 +0900 |
commit | 13d00729d422c84b1764c24251abcc785ea4adb1 (patch) | |
tree | 300f1816da7f1189965a564257e6c8591e166bc3 /src/backend/commands/explain.c | |
parent | 9b103f861ea9d74c4c43e80c5c5dfcdc1e61f4a2 (diff) | |
download | postgresql-13d00729d422c84b1764c24251abcc785ea4adb1.tar.gz postgresql-13d00729d422c84b1764c24251abcc785ea4adb1.zip |
Rename I/O timing statistics columns to shared_blk_{read|write}_time
These two counters, defined in BufferUsage to track respectively the
time spent while reading and writing blocks have historically only
tracked data related to shared buffers, when track_io_timing is enabled.
An upcoming patch to add specific counters for local buffers will take
advantage of this rename as it has come up that no data is currently
tracked for local buffers, and tracking local and shared buffers using
the same fields would be inconsistent with the treatment done for temp
buffers. Renaming the existing fields clarifies what the block type of
each stats field is.
pg_stat_statement is updated to reflect the rename. No extension
version bump is required as 5a3423ad8ee17 has done one, affecting v17~.
Author: Nazir Bilal Yavuz
Reviewed-by: Robert Haas, Melanie Plageman
Discussion: https://postgr.es/m/CAN55FZ19Ss279mZuqGbuUNxka0iPbLgYuOQXqAKewrjNrp27VA@mail.gmail.com
Diffstat (limited to 'src/backend/commands/explain.c')
-rw-r--r-- | src/backend/commands/explain.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c index 13217807eed..d6cf948f384 100644 --- a/src/backend/commands/explain.c +++ b/src/backend/commands/explain.c @@ -3562,12 +3562,13 @@ show_buffer_usage(ExplainState *es, const BufferUsage *usage, bool planning) usage->local_blks_written > 0); bool has_temp = (usage->temp_blks_read > 0 || usage->temp_blks_written > 0); - bool has_timing = (!INSTR_TIME_IS_ZERO(usage->blk_read_time) || - !INSTR_TIME_IS_ZERO(usage->blk_write_time)); + bool has_shared_timing = (!INSTR_TIME_IS_ZERO(usage->shared_blk_read_time) || + !INSTR_TIME_IS_ZERO(usage->shared_blk_write_time)); bool has_temp_timing = (!INSTR_TIME_IS_ZERO(usage->temp_blk_read_time) || !INSTR_TIME_IS_ZERO(usage->temp_blk_write_time)); bool show_planning = (planning && (has_shared || - has_local || has_temp || has_timing || + has_local || has_temp || + has_shared_timing || has_temp_timing)); if (show_planning) @@ -3633,20 +3634,20 @@ show_buffer_usage(ExplainState *es, const BufferUsage *usage, bool planning) } /* As above, show only positive counter values. */ - if (has_timing || has_temp_timing) + if (has_shared_timing || has_temp_timing) { ExplainIndentText(es); appendStringInfoString(es->str, "I/O Timings:"); - if (has_timing) + if (has_shared_timing) { - appendStringInfoString(es->str, " shared/local"); - if (!INSTR_TIME_IS_ZERO(usage->blk_read_time)) + appendStringInfoString(es->str, " shared"); + if (!INSTR_TIME_IS_ZERO(usage->shared_blk_read_time)) appendStringInfo(es->str, " read=%0.3f", - INSTR_TIME_GET_MILLISEC(usage->blk_read_time)); - if (!INSTR_TIME_IS_ZERO(usage->blk_write_time)) + INSTR_TIME_GET_MILLISEC(usage->shared_blk_read_time)); + if (!INSTR_TIME_IS_ZERO(usage->shared_blk_write_time)) appendStringInfo(es->str, " write=%0.3f", - INSTR_TIME_GET_MILLISEC(usage->blk_write_time)); + INSTR_TIME_GET_MILLISEC(usage->shared_blk_write_time)); if (has_temp_timing) appendStringInfoChar(es->str, ','); } @@ -3690,11 +3691,11 @@ show_buffer_usage(ExplainState *es, const BufferUsage *usage, bool planning) usage->temp_blks_written, es); if (track_io_timing) { - ExplainPropertyFloat("I/O Read Time", "ms", - INSTR_TIME_GET_MILLISEC(usage->blk_read_time), + ExplainPropertyFloat("Shared I/O Read Time", "ms", + INSTR_TIME_GET_MILLISEC(usage->shared_blk_read_time), 3, es); - ExplainPropertyFloat("I/O Write Time", "ms", - INSTR_TIME_GET_MILLISEC(usage->blk_write_time), + ExplainPropertyFloat("Shared I/O Write Time", "ms", + INSTR_TIME_GET_MILLISEC(usage->shared_blk_write_time), 3, es); ExplainPropertyFloat("Temp I/O Read Time", "ms", INSTR_TIME_GET_MILLISEC(usage->temp_blk_read_time), |