mirror of
https://github.com/postgres/postgres.git
synced 2025-07-02 09:02:37 +03:00
Track I/O timing for temporary file blocks in EXPLAIN (BUFFERS)
Previously, the output of EXPLAIN (BUFFERS) option showed only the I/O timing spent reading and writing shared and local buffers. This commit adds on top of that the I/O timing for temporary buffers in the output of EXPLAIN (for spilled external sorts, hashes, materialization. etc). This can be helpful for users in cases where the I/O related to temporary buffers is the bottleneck. Like its cousin, this information is available only when track_io_timing is enabled. Playing the patch, this is showing an extra overhead of up to 1% even when using gettimeofday() as implementation for interval timings, which is slightly within the usual range noise still that's measurable. Author: Masahiko Sawada Reviewed-by: Georgios Kokolatos, Melanie Plageman, Julien Rouhaud, Ranier Vilela Discussion: https://postgr.es/m/CAD21AoAJgotTeP83p6HiAGDhs_9Fw9pZ2J=_tYTsiO5Ob-V5GQ@mail.gmail.com
This commit is contained in:
@ -237,6 +237,8 @@ BufferUsageAdd(BufferUsage *dst, const BufferUsage *add)
|
||||
dst->temp_blks_written += add->temp_blks_written;
|
||||
INSTR_TIME_ADD(dst->blk_read_time, add->blk_read_time);
|
||||
INSTR_TIME_ADD(dst->blk_write_time, add->blk_write_time);
|
||||
INSTR_TIME_ADD(dst->temp_blk_read_time, add->temp_blk_read_time);
|
||||
INSTR_TIME_ADD(dst->temp_blk_write_time, add->temp_blk_write_time);
|
||||
}
|
||||
|
||||
/* dst += add - sub */
|
||||
@ -259,6 +261,10 @@ BufferUsageAccumDiff(BufferUsage *dst,
|
||||
add->blk_read_time, sub->blk_read_time);
|
||||
INSTR_TIME_ACCUM_DIFF(dst->blk_write_time,
|
||||
add->blk_write_time, sub->blk_write_time);
|
||||
INSTR_TIME_ACCUM_DIFF(dst->temp_blk_read_time,
|
||||
add->temp_blk_read_time, sub->temp_blk_read_time);
|
||||
INSTR_TIME_ACCUM_DIFF(dst->temp_blk_write_time,
|
||||
add->temp_blk_write_time, sub->temp_blk_write_time);
|
||||
}
|
||||
|
||||
/* helper functions for WAL usage accumulation */
|
||||
|
Reference in New Issue
Block a user