On Thu, Apr 21, 2022 at 4:28 PM Peter Geoghegan <p...@bowt.ie> wrote: > I don't think that there is any risk of one user of either variable > "clobbering" some other user -- the current values of the variables > are not actually meaningful at all. They're only useful as a way that > an arbitrary piece of code instruments an arbitrary operation, by > making their own copies, running whatever the operation is, and then > reporting on the deltas. Which makes it even more surprising that this > was overlooked until now.
I suppose code like pgstat_update_dbstats() would need to copy pgBufferUsage somewhere if we were to get rid of pgStatBlockReadTime and pgStatBlockWriteTime. That might not have been acceptable back when we had the old stats collector; frequent copying of pgBufferUsage might have non-trivial overhead. The relevant struct (BufferUsage) has over 10 64-bit integers, versus only 2 for pgStatBlockReadTime and pgStatBlockWriteTime. But does that matter anymore now that we have the cumulative stats system? Doesn't the redundancy seem like a problem? -- Peter Geoghegan