- Notifications
You must be signed in to change notification settings - Fork5k
Commit61171a6
committed
Look up backend type in pg_signal_backend() more cheaply.
Commitccd3802, which introduced the pg_signal_autovacuum_workerrole, added a call to pgstat_get_beentry_by_proc_number() for thepurpose of determining whether the process is an autovacuum worker.This function calls pgstat_read_current_status(), which can befairly expensive and may return cached, out-of-date information.Since we just need to look up the target backend's BackendType, andwe already know its ProcNumber, we can instead inspect theBackendStatusArray directly, which is much less expensive andpossibly more up-to-date. There are some caveats with thisapproach (which are documented in the code), but it's stillsubstantially better than before.Reported-by: Andres FreundReviewed-by: Andres FreundDiscussion:https://postgr.es/m/ujenaa2uabzfkwxwmfifawzdozh3ljr7geozlhftsuosgm7n7q%40g3utqqyyosb61 parent6a5bcf7 commit61171a6
File tree
3 files changed
+28
-2
lines changed- src
- backend
- storage/ipc
- utils/activity
- include/utils
3 files changed
+28
-2
lines changedLines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
88 | 88 |
| |
89 | 89 |
| |
90 | 90 |
| |
91 |
| - | |
| 91 | + | |
92 | 92 |
| |
93 |
| - | |
| 93 | + | |
94 | 94 |
| |
95 | 95 |
| |
96 | 96 |
| |
|
Lines changed: 25 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1036 | 1036 |
| |
1037 | 1037 |
| |
1038 | 1038 |
| |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
1039 | 1064 |
| |
1040 | 1065 |
| |
1041 | 1066 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
323 | 323 |
| |
324 | 324 |
| |
325 | 325 |
| |
| 326 | + | |
326 | 327 |
| |
327 | 328 |
| |
328 | 329 |
| |
|
0 commit comments
Comments
(0)