mirror of
https://github.com/postgres/postgres.git
synced 2025-11-07 19:06:32 +03:00
Make EXPLAIN (BUFFERS) track blocks dirtied, as well as those written.
Also expose the new counters through pg_stat_statements. Patch by me. Review by Fujii Masao and Greg Smith.
This commit is contained in:
@@ -988,6 +988,7 @@ MarkBufferDirty(Buffer buffer)
|
||||
if (dirtied)
|
||||
{
|
||||
VacuumPageDirty++;
|
||||
pgBufferUsage.shared_blks_dirtied++;
|
||||
if (VacuumCostActive)
|
||||
VacuumCostBalance += VacuumCostPageDirty;
|
||||
if (ProcGlobal->bgwriterLatch)
|
||||
|
||||
@@ -276,6 +276,10 @@ MarkLocalBufferDirty(Buffer buffer)
|
||||
Assert(LocalRefCount[bufid] > 0);
|
||||
|
||||
bufHdr = &LocalBufferDescriptors[bufid];
|
||||
|
||||
if (!(bufHdr->flags & BM_DIRTY))
|
||||
pgBufferUsage.local_blks_dirtied++;
|
||||
|
||||
bufHdr->flags |= BM_DIRTY;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user