Commit 4a37527
committed
pgstat: reduce timer overhead by leaving timer running.
Previously the timer was enabled whenever there were any pending stats after
executing a statement, just to then be disabled again when not idle
anymore. That lead to an increase in GetCurrentTimestamp() calls from within
timeout.c compared to 14.
To avoid that increase, leave the timer enabled until stats are reported,
rather than until idle. The timer is only disabled once the pending stats have
been reported.
For me this fixes the increase in GetCurrentTimestamp() calls, there now are
fewer calls in 15 than in 14, in the previously slowed down workload.
While at it, also update assertion in pgstat_report_stat() to be more precise.
Author: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/20220616233130.rparivafipt6doj3@alap3.anarazel.de
Backpatch: 15-1 parent 5a1ab89 commit 4a37527
2 files changed
+32
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3371 | 3371 | | |
3372 | 3372 | | |
3373 | 3373 | | |
3374 | | - | |
| 3374 | + | |
| 3375 | + | |
| 3376 | + | |
| 3377 | + | |
| 3378 | + | |
| 3379 | + | |
3375 | 3380 | | |
3376 | | - | |
3377 | | - | |
3378 | 3381 | | |
3379 | 3382 | | |
3380 | 3383 | | |
| |||
4051 | 4054 | | |
4052 | 4055 | | |
4053 | 4056 | | |
4054 | | - | |
4055 | 4057 | | |
4056 | 4058 | | |
4057 | 4059 | | |
| |||
4428 | 4430 | | |
4429 | 4431 | | |
4430 | 4432 | | |
4431 | | - | |
| 4433 | + | |
| 4434 | + | |
| 4435 | + | |
| 4436 | + | |
| 4437 | + | |
| 4438 | + | |
| 4439 | + | |
| 4440 | + | |
| 4441 | + | |
| 4442 | + | |
| 4443 | + | |
| 4444 | + | |
| 4445 | + | |
4432 | 4446 | | |
4433 | 4447 | | |
4434 | 4448 | | |
4435 | | - | |
4436 | | - | |
4437 | | - | |
| 4449 | + | |
| 4450 | + | |
| 4451 | + | |
| 4452 | + | |
| 4453 | + | |
| 4454 | + | |
| 4455 | + | |
| 4456 | + | |
| 4457 | + | |
4438 | 4458 | | |
4439 | 4459 | | |
4440 | 4460 | | |
| |||
4470 | 4490 | | |
4471 | 4491 | | |
4472 | 4492 | | |
4473 | | - | |
4474 | | - | |
4475 | | - | |
4476 | | - | |
| 4493 | + | |
| 4494 | + | |
| 4495 | + | |
4477 | 4496 | | |
4478 | 4497 | | |
4479 | 4498 | | |
| |||
4488 | 4507 | | |
4489 | 4508 | | |
4490 | 4509 | | |
4491 | | - | |
4492 | | - | |
4493 | | - | |
4494 | | - | |
4495 | | - | |
4496 | 4510 | | |
4497 | 4511 | | |
4498 | 4512 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
571 | 571 | | |
572 | 572 | | |
573 | 573 | | |
574 | | - | |
| 574 | + | |
575 | 575 | | |
576 | 576 | | |
577 | 577 | | |
| |||
0 commit comments