Re: pg_stat_bgwriter.buffers_backend is pretty meaningless (and more?)
Melanie Plageman <melanieplageman@gmail.com>
Attachments
- v27-0003-Track-IO-operation-statistics.patch (text/x-patch) patch v27-0003
- v27-0004-Add-system-view-tracking-IO-ops-per-backend-type.patch (text/x-patch) patch v27-0004
- v27-0001-Add-BackendType-for-standalone-backends.patch (text/x-patch) patch v27-0001
- v27-0002-Remove-unneeded-call-to-pgstat_report_wal.patch (text/x-patch) patch v27-0002
I've attached v27 of the patch. I've renamed IOPATH to IOCONTEXT. I also have added assertions to confirm that unexpected statistics are not being accumulated. There are also assorted other cleanups and changes. It would be good to confirm that the rows being skipped and cells that are NULL in the view are the correct ones. The startup process will never use a BufferAccessStrategy, right? On Wed, Jul 20, 2022 at 12:50 PM Andres Freund <andres@anarazel.de> wrote: > > > Subject: [PATCH v26 3/4] Track IO operation statistics > > > @@ -978,8 +979,17 @@ ReadBuffer_common(SMgrRelation smgr, char > relpersistence, ForkNumber forkNum, > > > > bufBlock = isLocalBuf ? LocalBufHdrGetBlock(bufHdr) : > BufHdrGetBlock(bufHdr); > > > > + if (isLocalBuf) > > + io_path = IOPATH_LOCAL; > > + else if (strategy != NULL) > > + io_path = IOPATH_STRATEGY; > > + else > > + io_path = IOPATH_SHARED; > > Seems a bit ugly to have an if (isLocalBuf) just after an isLocalBuf ?. > Changed this. > > > > + /* > > + * When a strategy is in use, reused buffers from > the strategy ring will > > + * be counted as allocations for the purposes of > IO Operation statistics > > + * tracking. > > + * > > + * However, even when a strategy is in use, if a > new buffer must be > > + * allocated from shared buffers and added to the > ring, this is counted > > + * as a IOPATH_SHARED allocation. > > + */ > > There's a bit too much duplication between the paragraphs... > I actually think the two paragraphs are making separate points. I've edited this, so see if you like it better now. > > > @@ -628,6 +637,9 @@ pgstat_report_stat(bool force) > > /* flush database / relation / function / ... stats */ > > partial_flush |= pgstat_flush_pending_entries(nowait); > > > > + /* flush IO Operations stats */ > > + partial_flush |= pgstat_flush_io_ops(nowait); > > Could you either add a note to the commit message that the stats file > version needs to be increased, or just iclude that in the patch. > > Bumped the stats file version in attached patchset. - Melanie
Commits
-
Stabilize pg_stat_io writes test
- ef719e7b32fc 16.0 landed
-
Fix flakey pg_stat_io test
- 1be0fdb9de55 16.0 landed
-
Suppress more compiler warnings in new pgstats code.
- b1b86820d84e 16.0 landed
-
Suppress compiler warnings in new pgstats code.
- 728560db7d86 16.0 landed
-
Add tests for pg_stat_io
- 10a082bf7215 16.0 landed
-
Create regress_tblspc in test_setup
- 9c83bbcf7ef6 16.0 landed
-
Add pg_stat_io view, providing more detailed IO statistics
- a9c70b46dbe1 16.0 landed
-
pgstat: Track more detailed relation IO statistics
- f30d62c2fc60 16.0 landed
-
pgstat: Infrastructure for more detailed IO statistics
- 28e626bde00e 16.0 landed
-
doc: Fix some issues in logical replication section
- 4f74f5641d53 16.0 cited
-
Manual cleanup and pgindent of pgstat and bufmgr related code
- 250c8ee07ede 16.0 landed
-
Have the planner consider Incremental Sort for DISTINCT
- 3c6fc58209f2 16.0 cited
-
Use actual backend IDs in pg_stat_get_backend_idset() and friends.
- d7e39d72ca1c 16.0 cited
-
Remove redundant call to pgstat_report_wal()
- 1bdd54e662d5 16.0 landed
-
Add BackendType for standalone backends
- 0c679464a837 16.0 landed
-
Initialize backend status reporting during bootstrap.
- 3b34645678d1 15.0 landed