]> begriffs open source - ai-pg/blob - full-docs/txt/monitoring-ps.txt
Convert HTML docs to more streamlined TXT
[ai-pg] / full-docs / txt / monitoring-ps.txt
1
2 27.1. Standard Unix Tools #
3
4    On most Unix platforms, PostgreSQL modifies its command title as
5    reported by ps, so that individual server processes can readily be
6    identified. A sample display is
7 $ ps auxww | grep ^postgres
8 postgres  15551  0.0  0.1  57536  7132 pts/0    S    18:02   0:00 postgres -i
9 postgres  15554  0.0  0.0  57536  1184 ?        Ss   18:02   0:00 postgres: back
10 ground writer
11 postgres  15555  0.0  0.0  57536   916 ?        Ss   18:02   0:00 postgres: chec
12 kpointer
13 postgres  15556  0.0  0.0  57536   916 ?        Ss   18:02   0:00 postgres: walw
14 riter
15 postgres  15557  0.0  0.0  58504  2244 ?        Ss   18:02   0:00 postgres: auto
16 vacuum launcher
17 postgres  15582  0.0  0.0  58772  3080 ?        Ss   18:04   0:00 postgres: joe
18 runbug 127.0.0.1 idle
19 postgres  15606  0.0  0.0  58772  3052 ?        Ss   18:07   0:00 postgres: tgl
20 regression [local] SELECT waiting
21 postgres  15610  0.0  0.0  58772  3056 ?        Ss   18:07   0:00 postgres: tgl
22 regression [local] idle in transaction
23
24    (The appropriate invocation of ps varies across different platforms, as
25    do the details of what is shown. This example is from a recent Linux
26    system.) The first process listed here is the primary server process.
27    The command arguments shown for it are the same ones used when it was
28    launched. The next four processes are background worker processes
29    automatically launched by the primary process. (The “autovacuum
30    launcher” process will not be present if you have set the system not to
31    run autovacuum.) Each of the remaining processes is a server process
32    handling one client connection. Each such process sets its command line
33    display in the form
34 postgres: user database host activity
35
36    The user, database, and (client) host items remain the same for the
37    life of the client connection, but the activity indicator changes. The
38    activity can be idle (i.e., waiting for a client command), idle in
39    transaction (waiting for client inside a BEGIN block), or a command
40    type name such as SELECT. Also, waiting is appended if the server
41    process is presently waiting on a lock held by another session. In the
42    above example we can infer that process 15606 is waiting for process
43    15610 to complete its transaction and thereby release some lock.
44    (Process 15610 must be the blocker, because there is no other active
45    session. In more complicated cases it would be necessary to look into
46    the pg_locks system view to determine who is blocking whom.)
47
48    If cluster_name has been configured the cluster name will also be shown
49    in ps output:
50 $ psql -c 'SHOW cluster_name'
51  cluster_name
52 --------------
53  server1
54 (1 row)
55
56 $ ps aux|grep server1
57 postgres   27093  0.0  0.0  30096  2752 ?        Ss   11:34   0:00 postgres: ser
58 ver1: background writer
59 ...
60
61    If you have turned off update_process_title then the activity indicator
62    is not updated; the process title is set only once when a new process
63    is launched. On some platforms this saves a measurable amount of
64    per-command overhead; on others it's insignificant.
65
66 Tip
67
68    Solaris requires special handling. You must use /usr/ucb/ps, rather
69    than /bin/ps. You also must use two w flags, not just one. In addition,
70    your original invocation of the postgres command must have a shorter ps
71    status display than that provided by each server process. If you fail
72    to do all three things, the ps output for each server process will be
73    the original postgres command line.