Movatterモバイル変換


[0]ホーム

URL:



Facebook
Postgres Pro
Facebook
Downloads
27.1. Standard Unix Tools
Prev UpChapter 27. Monitoring Database ActivityHome Next

27.1. Standard Unix Tools#

On most Unix platforms,PostgreSQL modifies its command title as reported byps, so that individual server processes can readily be identified. A sample display is

$ ps auxww | grep ^postgrespostgres  15551  0.0  0.1  57536  7132 pts/0    S    18:02   0:00 postgres -ipostgres  15554  0.0  0.0  57536  1184 ?        Ss   18:02   0:00 postgres: background writerpostgres  15555  0.0  0.0  57536   916 ?        Ss   18:02   0:00 postgres: checkpointerpostgres  15556  0.0  0.0  57536   916 ?        Ss   18:02   0:00 postgres: walwriterpostgres  15557  0.0  0.0  58504  2244 ?        Ss   18:02   0:00 postgres: autovacuum launcherpostgres  15582  0.0  0.0  58772  3080 ?        Ss   18:04   0:00 postgres: joe runbug 127.0.0.1 idlepostgres  15606  0.0  0.0  58772  3052 ?        Ss   18:07   0:00 postgres: tgl regression [local] SELECT waitingpostgres  15610  0.0  0.0  58772  3056 ?        Ss   18:07   0:00 postgres: tgl regression [local] idle in transaction

(The appropriate invocation ofps varies across different platforms, as do the details of what is shown. This example is from a recent Linux system.) The first process listed here is the primary server process. The command arguments shown for it are the same ones used when it was launched. The next four processes are background worker processes automatically launched by the primary process. (Theautovacuum launcher process will not be present if you have set the system not to run autovacuum.) Each of the remaining processes is a server process handling one client connection. Each such process sets its command line display in the form

postgres:userdatabasehostactivity

The user, database, and (client) host items remain the same for the life of the client connection, but the activity indicator changes. The activity can beidle (i.e., waiting for a client command),idle in transaction (waiting for client inside aBEGIN block), or a command type name such asSELECT. Also,waiting is appended if the server process is presently waiting on a lock held by another session. In the above example we can infer that process 15606 is waiting for process 15610 to complete its transaction and thereby release some lock. (Process 15610 must be the blocker, because there is no other active session. In more complicated cases it would be necessary to look into thepg_locks system view to determine who is blocking whom.)

Ifcluster_name has been configured the cluster name will also be shown inps output:

$ psql -c 'SHOW cluster_name' cluster_name-------------- server1(1 row)$ ps aux|grep server1postgres   27093  0.0  0.0  30096  2752 ?        Ss   11:34   0:00 postgres: server1: background writer...

If you have turned offupdate_process_title then the activity indicator is not updated; the process title is set only once when a new process is launched. On some platforms this saves a measurable amount of per-command overhead; on others it's insignificant.

Tip

Solaris requires special handling. You must use/usr/ucb/ps, rather than/bin/ps. You also must use twow flags, not just one. In addition, your original invocation of thepostgres command must have a shorterps status display than that provided by each server process. If you fail to do all three things, theps output for each server process will be the originalpostgres command line.


Prev Up Next
Chapter 27. Monitoring Database Activity Home 27.2. The Cumulative Statistics System
pdfepub
Go to PostgreSQL 17
By continuing to browse this website, you agree to the use of cookies. Go toPrivacy Policy.

[8]ページ先頭

©2009-2025 Movatter.jp