Hello hackers,
Andrey and Nik, thank you for selecting this patch for review in
Postgres Hacking 101: I've modified the patch based both on your email
and the video.
1. Session statistics is now collected only for client backends. PG
internal processes like wal sender seem to stop sending statistics
after they have entered their respective main loops.
2. Fastpath state now counts towards the running state. I think this
special case does not justify tracking two extra numbers for every
client backend.
3. I've added a small test for pg_stat_session similar to other tests
in src/test/regress/sql/sysviews.sql
4. Here are the pb_bench results requested in the video review:
Conditions: no assertions, number of transactions = 1000
The query: SELECT generate_series(1, 10000000) OFFSET 10000000;
With pg_stat_session:
latency average = 324.480 ms
tps = 3.081857 (without initial connection time)
Without pg_stat_session:
latency average = 327.370 ms
tps = 3.054651 (without initial connection time)
Regards,
Sergey