Robert Haas <robertmhaas@gmail.com> writes:
> It occurs to me that pgstat_report_xact_end_timestamp doesn't really
> need to follow the protocol of bumping the change count before and
> after bumping the timestamp. We elsewhere assume that four-byte reads
> and writes are atomic, so there's no harm in assuming the same thing
> here (and if they're not... then the change-count thing is pretty
> dubious anyway). I think it's sufficient to just set the value, full
> stop.
I agree you can read the value without that, but I think that setting
it should still bump the change count. Otherwise there's no way for
another process to collect the whole struct and be sure that it's
self-consistent. We may not have a critical need for that right now,
but it's silly to foreclose the possibility to save a cycle or so.
regards, tom lane