postgres=# select *,pg_get_backtrace(pid) from pg_stat_activity where backend_type in ('client backend','checkpointer','background writer') and pid <> pg_backend_pid();-[ RECORD 1 ]----+-------------------------------------------------------------datid | 5
datname | postgres
pid | 3133583
leader_pid |
usesysid | 10
usename | postgres
application_name | psql
client_addr |
client_hostname |
client_port | -1
backend_start | 2026-05-12 00:16:04.383869+08
xact_start |
query_start | 2026-05-12 00:16:13.353197+08
state_change | 2026-05-12 00:16:13.353285+08
wait_event_type | Client
wait_event | ClientRead
state | idle
backend_xid |
backend_xmin |
query_id |
query | select1;
backend_type | client backend
pg_get_backtrace | #0 0x00007f48d004ff57 in epoll_wait+0x17 +
| #1 0x000000000091416b in WaitEventSetWait+0x12b +
| #2 0x00000000007882e4 in secure_read+0xd4 +
| #3 0x00000000007930ce in pq_recvbuf.lto_priv.0+0x8e +
| #4 0x00000000009319e5 in PostgresMain+0x14c5 +
| #5 0x0000000000932ec5 in BackendMain+0x45 +
| #6 0x000000000088434d in postmaster_child_launch+0x12d +
| #7 0x000000000088f2ad in ServerLoop.lto_priv.0+0x52d +
| #8 0x0000000000885d19 in PostmasterMain+0xce9 +
| #9 0x000000000052fa80 in main+0x1d0 +
| #10 0x00007f48cff612a0 in __libc_start_call_main+0x80 +
| #11 0x00007f48cff61359 in __libc_start_main+0x89 +
| #12 0x0000000000530075 in _start+0x25-[ RECORD 2 ]----+-------------------------------------------------------------datid |
datname |
pid | 373780
leader_pid |
usesysid |
usename |
application_name |
client_addr |
client_hostname |
client_port |
backend_start | 2026-05-08 11:04:19.226274+08
xact_start |
query_start |
state_change |
wait_event_type | Activity
wait_event | BgwriterHibernate
state |
backend_xid |
backend_xmin |
query_id |
query |
backend_type | background writer
pg_get_backtrace | #0 0x00007f48d004ff57 in epoll_wait+0x17 +
| #1 0x000000000091416b in WaitEventSetWait+0x12b +
| #2 0x000000000090b6a5 in WaitLatch+0x75 +
| #3 0x000000000088310d in BackgroundWriterMain+0x2ed +
| #4 0x000000000088434d in postmaster_child_launch+0x12d +
| #5 0x000000000088d12f in StartChildProcess.lto_priv.0+0x2f+
| #6 0x0000000000885dfa in PostmasterMain+0xdca +
| #7 0x000000000052fa80 in main+0x1d0 +
| #8 0x00007f48cff612a0 in __libc_start_call_main+0x80 +
| #9 0x00007f48cff61359 in __libc_start_main+0x89 +
| #10 0x0000000000530075 in _start+0x25-[ RECORD 3 ]----+-------------------------------------------------------------datid |
datname |
pid | 373779
leader_pid |
usesysid |
usename |
application_name |
client_addr |
client_hostname |
client_port |
backend_start | 2026-05-08 11:04:19.225799+08
xact_start |
query_start |
state_change |
wait_event_type | Activity
wait_event | CheckpointerMain
state |
backend_xid |
backend_xmin |
query_id |
query |
backend_type | checkpointer
pg_get_backtrace | #0 0x00007f48d004ff57 in epoll_wait+0x17 +
| #1 0x000000000091416b in WaitEventSetWait+0x12b +
| #2 0x000000000090b6a5 in WaitLatch+0x75 +
| #3 0x0000000000883d03 in CheckpointerMain+0x503 +
| #4 0x000000000088434d in postmaster_child_launch+0x12d +
| #5 0x000000000088d12f in StartChildProcess.lto_priv.0+0x2f+
| #6 0x0000000000885e10 in PostmasterMain+0xde0 +
| #7 0x000000000052fa80 in main+0x1d0 +
| #8 0x00007f48cff612a0 in __libc_start_call_main+0x80 +
| #9 0x00007f48cff61359 in __libc_start_main+0x89 +
| #10 0x0000000000530075 in _start+0x25postgres=#
2026-05-12 00:26:06.671 CST [3139292] LOG: backtrace of PID 373776 2026-05-12 00:26:06.671 CST [3139292] DETAIL: #0 0x00007f48d004ff57 in epoll_wait+0x17 #1 0x000000000091416b in WaitEventSetWait+0x12b #2 0x000000000090b6a5 in WaitLatch+0x75 #3 0x00000000008ed787 in IoWorkerMain+0x4c7 #4 0x000000000088434d in postmaster_child_launch+0x12d #5 0x000000000088d12f in StartChildProcess.lto_priv.0+0x2f #6 0x000000000088d2fb in maybe_adjust_io_workers.lto_priv.0+0x8b #7 0x0000000000885cd8 in PostmasterMain+0xca8 #8 0x000000000052fa80 in main+0x1d0 #9 0x00007f48cff612a0 in __libc_start_call_main+0x80 #10 0x00007f48cff61359 in __libc_start_main+0x89 #11 0x0000000000530075 in _start+0x252026-05-12 00:26:06.671 CST [3139292] STATEMENT: select pg_log_backtrace(373776);
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/70033867/viewspace-3171629/ ,如需转载,请注明出处,否则将追究法律责任。