postgresql/src/backend
Nathan Bossart 61171a632d Look up backend type in pg_signal_backend() more cheaply.
Commit ccd38024bc, which introduced the pg_signal_autovacuum_worker
role, added a call to pgstat_get_beentry_by_proc_number() for the
purpose of determining whether the process is an autovacuum worker.
This function calls pgstat_read_current_status(), which can be
fairly expensive and may return cached, out-of-date information.
Since we just need to look up the target backend's BackendType, and
we already know its ProcNumber, we can instead inspect the
BackendStatusArray directly, which is much less expensive and
possibly more up-to-date.  There are some caveats with this
approach (which are documented in the code), but it's still
substantially better than before.

Reported-by: Andres Freund
Reviewed-by: Andres Freund
Discussion: https://postgr.es/m/ujenaa2uabzfkwxwmfifawzdozh3ljr7geozlhftsuosgm7n7q%40g3utqqyyosb6
2024-11-27 10:32:25 -06:00
..
access Improve slightly misleading internal error message 2024-11-27 10:55:35 +01:00
archive Apply more quoting to GUC names in messages 2024-09-04 13:50:44 +09:00
backup Clean up newlines following left parentheses 2024-11-26 17:10:07 +01:00
bootstrap Assign a child slot to every postmaster child process 2024-11-14 16:12:28 +02:00
catalog Proper object locking for GRANT/REVOKE 2024-11-15 11:03:48 +01:00
commands pgindent run 2024-11-21 21:40:17 +01:00
executor Fix NULLIF()'s handling of read-write expanded objects. 2024-11-25 18:09:09 -05:00
foreign Improve style of two code paths 2024-10-08 10:51:20 +09:00
jit Fix NULLIF()'s handling of read-write expanded objects. 2024-11-25 18:09:09 -05:00
lib Revert pg_wal_replay_wait() stored procedure 2024-11-04 22:47:57 +02:00
libpq Remove unused #include's from backend .c files 2024-10-27 08:26:50 +01:00
main Remove unused #include's from backend .c files 2024-10-27 08:26:50 +01:00
nodes Add pg_constraint rows for not-null constraints 2024-11-08 13:28:48 +01:00
optimizer Remove dead code in get_param_path_clause_serials() 2024-11-26 09:27:53 +09:00
parser Add pg_constraint rows for not-null constraints 2024-11-08 13:28:48 +01:00
partitioning Revert support for ALTER TABLE ... MERGE/SPLIT PARTITION(S) commands 2024-08-24 18:48:48 +03:00
po Translation updates 2024-06-24 13:11:27 +02:00
port Require memory barrier support. 2024-07-30 23:01:55 +12:00
postmaster postmaster: Reduce verbosity of environment dump debug message 2024-11-27 11:17:23 -05:00
regex Avoid assertion due to disconnected NFA sub-graphs in regex parsing. 2024-11-15 18:23:38 -05:00
replication Improve error message for replication of generated columns. 2024-11-27 09:09:20 +05:30
rewrite Ensure cached plans are correctly marked as dependent on role. 2024-11-11 09:00:00 -06:00
snowball Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
statistics Disallow modifying statistics on system columns. 2024-11-22 12:40:24 -08:00
storage Look up backend type in pg_signal_backend() more cheaply. 2024-11-27 10:32:25 -06:00
tcop Handle better implicit transaction state of pipeline mode 2024-11-27 09:31:22 +09:00
tsearch Constify fields and parameters in spell.c 2024-08-06 23:04:51 +03:00
utils Look up backend type in pg_signal_backend() more cheaply. 2024-11-27 10:32:25 -06:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
common.mk Blind attempt to fix LLVM dependency in the backend 2022-09-15 10:53:48 +07:00
Makefile Fix make build on MinGW 2024-06-21 08:17:23 +02:00
meson.build meson: Fix import library name in Windows 2024-06-20 09:08:36 +02:00
nls.mk Add missing gettext triggers 2024-05-14 12:57:22 +02:00