diff options
| author | Tom Lane | 2007-04-30 03:23:49 +0000 |
|---|---|---|
| committer | Tom Lane | 2007-04-30 03:23:49 +0000 |
| commit | 957d08c81f9cc277725c83b9381c5154b6318a5e (patch) | |
| tree | 1c665d6e63c2cb02156df44a3519d2a0bebcaea3 /src/test | |
| parent | 57b82bf324285464783796e5614d5f9aadd0817f (diff) | |
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.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/regress/expected/stats.out | 8 | ||||
| -rw-r--r-- | src/test/regress/sql/stats.sql | 4 |
2 files changed, 12 insertions, 0 deletions
diff --git a/src/test/regress/expected/stats.out b/src/test/regress/expected/stats.out index fc76d14225..af0f630a8d 100644 --- a/src/test/regress/expected/stats.out +++ b/src/test/regress/expected/stats.out @@ -73,6 +73,14 @@ SELECT count(*) FROM tenk2 WHERE unique1 = 1; 1 (1 row) +-- force the rate-limiting logic in pgstat_report_tabstat() to time out +-- and send a message +SELECT pg_sleep(1.0); + pg_sleep +---------- + +(1 row) + -- wait for stats collector to update SELECT wait_for_stats(); wait_for_stats diff --git a/src/test/regress/sql/stats.sql b/src/test/regress/sql/stats.sql index cde38b3a37..9900b9114a 100644 --- a/src/test/regress/sql/stats.sql +++ b/src/test/regress/sql/stats.sql @@ -60,6 +60,10 @@ SELECT count(*) FROM tenk2; -- do an indexscan SELECT count(*) FROM tenk2 WHERE unique1 = 1; +-- force the rate-limiting logic in pgstat_report_tabstat() to time out +-- and send a message +SELECT pg_sleep(1.0); + -- wait for stats collector to update SELECT wait_for_stats(); |
