> Do you mean adding the user ID on top of Shihao's 0002? If so, I can have a look,
> unless Shihao is already planning to update the patch along those lines?
Done in v8, attached.
0001 is the PID check, same as v7-0002. It goes first now because 0002
needs a field in PgStat_Backend.
0002 stores the user ID in PgStat_Backend next to the PID when the entry
is created, and pg_stat_get_backend_io(), wal() and lock() check the
caller against that instead of the beentry. The reset callback restores
both fields. pg_stat_get_backend_subxact() still checks the beentry, the
counters it reports come from there.
Thanks,
Shihao