Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
monitoring-ps.html77 linesDownload Raw Back to html
1<?xml version="1.0" encoding="UTF-8" standalone="no"?>2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>28.1. Standard Unix Tools</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="monitoring.html" title="Chapter 28. Monitoring Database Activity" /><link rel="next" href="monitoring-stats.html" title="28.2. The Cumulative Statistics System" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">28.1. Standard Unix Tools</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="monitoring.html" title="Chapter 28. Monitoring Database Activity">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="monitoring.html" title="Chapter 28. Monitoring Database Activity">Up</a></td><th width="60%" align="center">Chapter 28. Monitoring Database Activity</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 16.3 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="monitoring-stats.html" title="28.2. The Cumulative Statistics System">Next</a></td></tr></table><hr /></div><div class="sect1" id="MONITORING-PS"><div class="titlepage"><div><div><h2 class="title" style="clear: both">28.1. Standard Unix Tools <a href="#MONITORING-PS" class="id_link">#</a></h2></div></div></div><a id="id-1.6.15.6.2" class="indexterm"></a><p>3   On most Unix platforms, <span class="productname">PostgreSQL</span> modifies its4   command title as reported by <code class="command">ps</code>, so that individual server5   processes can readily be identified.  A sample display is6 7</p><pre class="screen">8$ ps auxww | grep ^postgres9postgres  15551  0.0  0.1  57536  7132 pts/0    S    18:02   0:00 postgres -i10postgres  15554  0.0  0.0  57536  1184 ?        Ss   18:02   0:00 postgres: background writer11postgres  15555  0.0  0.0  57536   916 ?        Ss   18:02   0:00 postgres: checkpointer12postgres  15556  0.0  0.0  57536   916 ?        Ss   18:02   0:00 postgres: walwriter13postgres  15557  0.0  0.0  58504  2244 ?        Ss   18:02   0:00 postgres: autovacuum launcher14postgres  15582  0.0  0.0  58772  3080 ?        Ss   18:04   0:00 postgres: joe runbug 127.0.0.1 idle15postgres  15606  0.0  0.0  58772  3052 ?        Ss   18:07   0:00 postgres: tgl regression [local] SELECT waiting16postgres  15610  0.0  0.0  58772  3056 ?        Ss   18:07   0:00 postgres: tgl regression [local] idle in transaction17</pre><p>18 19   (The appropriate invocation of <code class="command">ps</code> varies across different20   platforms, as do the details of what is shown.  This example is from a21   recent Linux system.)  The first process listed here is the22   primary server process.  The command arguments23   shown for it are the same ones used when it was launched.  The next four24   processes are background worker processes automatically launched by the25   primary process.  (The <span class="quote">“<span class="quote">autovacuum launcher</span>”</span> process will not26   be present if you have set the system not to run autovacuum.)27   Each of the remaining28   processes is a server process handling one client connection.  Each such29   process sets its command line display in the form30 31</p><pre class="screen">32postgres: <em class="replaceable"><code>user</code></em> <em class="replaceable"><code>database</code></em> <em class="replaceable"><code>host</code></em> <em class="replaceable"><code>activity</code></em>33</pre><p>34 35  The user, database, and (client) host items remain the same for36  the life of the client connection, but the activity indicator changes.37  The activity can be <code class="literal">idle</code> (i.e., waiting for a client command),38  <code class="literal">idle in transaction</code> (waiting for client inside a <code class="command">BEGIN</code> block),39  or a command type name such as <code class="literal">SELECT</code>.  Also,40  <code class="literal">waiting</code> is appended if the server process is presently waiting41  on a lock held by another session.  In the above example we can infer42  that process 15606 is waiting for process 15610 to complete its transaction43  and thereby release some lock.  (Process 15610 must be the blocker, because44  there is no other active session.  In more complicated cases it would be45  necessary to look into the46  <a class="link" href="view-pg-locks.html" title="54.12. pg_locks"><code class="structname">pg_locks</code></a>47  system view to determine who is blocking whom.)48  </p><p>49   If <a class="xref" href="runtime-config-logging.html#GUC-CLUSTER-NAME">cluster_name</a> has been configured the50   cluster name will also be shown in <code class="command">ps</code> output:51</p><pre class="screen">52$ psql -c 'SHOW cluster_name'53 cluster_name54--------------55 server156(1 row)57 58$ ps aux|grep server159postgres   27093  0.0  0.0  30096  2752 ?        Ss   11:34   0:00 postgres: server1: background writer60...61</pre><p>62  </p><p>63   If you have turned off <a class="xref" href="runtime-config-logging.html#GUC-UPDATE-PROCESS-TITLE">update_process_title</a> then the64   activity indicator is not updated; the process title is set only once65   when a new process is launched.  On some platforms this saves a measurable66   amount of per-command overhead;  on others it's insignificant.67  </p><div class="tip"><h3 class="title">Tip</h3><p>68  <span class="productname">Solaris</span> requires special handling. You must69  use <code class="command">/usr/ucb/ps</code>, rather than70  <code class="command">/bin/ps</code>. You also must use two <code class="option">w</code>71  flags, not just one. In addition, your original invocation of the72  <code class="command">postgres</code> command must have a shorter73  <code class="command">ps</code> status display than that provided by each74  server process.  If you fail to do all three things, the <code class="command">ps</code>75  output for each server process will be the original <code class="command">postgres</code>76  command line.77  </p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="monitoring.html" title="Chapter 28. Monitoring Database Activity">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="monitoring.html" title="Chapter 28. Monitoring Database Activity">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="monitoring-stats.html" title="28.2. The Cumulative Statistics System">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 28. Monitoring Database Activity </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 16.3 Documentation">Home</a></td><td width="40%" align="right" valign="top"> 28.2. The Cumulative Statistics System</td></tr></table></div></body></html>
codekingpro/portable-devtools · Team Ai