Implement rate-limiting logic on how often backends will attempt to send
messages to the stats collector. This avoids the problem that enabling stats_row_level for autovacuum has a significant overhead for short read-only transactions, as noted by Arjen van der Meijden. We can avoid an extra gettimeofday call by piggybacking on the one done for WAL-logging xact commit or abort (although that doesn't help read-only transactions, since they don't WAL-log anything). In my proposal for this, I noted that we could change the WAL log entries for commit/abort to record full TimestampTz precision, instead of only time_t as at present. That's not done in this patch, but will be committed separately.
Showing
- src/backend/access/transam/xact.c 33 additions, 4 deletionssrc/backend/access/transam/xact.c
- src/backend/commands/analyze.c 4 additions, 18 deletionssrc/backend/commands/analyze.c
- src/backend/commands/vacuumlazy.c 4 additions, 18 deletionssrc/backend/commands/vacuumlazy.c
- src/backend/postmaster/pgstat.c 23 additions, 4 deletionssrc/backend/postmaster/pgstat.c
- src/backend/utils/adt/timestamp.c 22 additions, 1 deletionsrc/backend/utils/adt/timestamp.c
- src/include/access/xact.h 2 additions, 1 deletionsrc/include/access/xact.h
- src/include/utils/timestamp.h 4 additions, 1 deletionsrc/include/utils/timestamp.h
- src/test/regress/expected/stats.out 8 additions, 0 deletionssrc/test/regress/expected/stats.out
- src/test/regress/sql/stats.sql 4 additions, 0 deletionssrc/test/regress/sql/stats.sql
Loading
Please register or sign in to comment