1- <!-- $PostgreSQL: pgsql/doc/src/sgml/monitoring.sgml,v 1.33 2006/06/18 15:38:35 petere Exp $ -->
1+ <!-- $PostgreSQL: pgsql/doc/src/sgml/monitoring.sgml,v 1.34 2006/06/19 01:51:21 tgl Exp $ -->
22
33<chapter id="monitoring">
44 <title>Monitoring Database Activity</title>
@@ -109,9 +109,14 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re
109109 <productname>PostgreSQL</productname>'s <firstterm>statistics collector</>
110110 is a subsystem that supports collection and reporting of information about
111111 server activity. Presently, the collector can count accesses to tables
112- and indexes in both disk-block and individual-row terms. It also supports
113- determining the exact command currently being executed by other server
114- processes.
112+ and indexes in both disk-block and individual-row terms.
113+ </para>
114+
115+ <para>
116+ <productname>PostgreSQL</productname> also supports determining the exact
117+ command currently being executed by other server processes. This is an
118+ independent facility that can be enabled or disabled whether or not
119+ block-level and row-level statistics are being collected.
115120 </para>
116121
117122 <sect2 id="monitoring-stats-setup">
@@ -136,15 +141,21 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re
136141 </para>
137142
138143 <para>
139- The parameters <xref linkend="guc-stats-command-string">,
140- <xref linkend="guc-stats-block-level">, and <xref
144+ The parameters <xref linkend="guc-stats-block-level"> and <xref
141145 linkend="guc-stats-row-level"> control how much information is
142146 actually sent to the collector and thus determine how much run-time
143147 overhead occurs. These respectively determine whether a server
144- processsends its current command string, disk-block-level access
145- statistics, and row-level access statistics to the collector.
148+ processtracks disk-block-level access
149+ statistics and row-level access statistics and sends these to the collector.
146150 Additionally, per-database transaction commit and abort statistics
147- are collected if any of these parameters are set.
151+ are collected if either of these parameters are set.
152+ </para>
153+
154+ <para>
155+ The parameter <xref linkend="guc-stats-command-string"> enables monitoring
156+ of the current command being executed by any server process.
157+ The statistics collector subprocess need not be running to enable this
158+ feature.
148159 </para>
149160
150161 <para>
@@ -165,7 +176,7 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re
165176 very few statistics are collected in the default
166177 configuration. Enabling one or more of these configuration
167178 variables will significantly enhance the amount of useful data
168- produced by the statisticscollector , at the expense of
179+ produced by the statisticsfacilities , at the expense of
169180 additional run-time overhead.
170181 </para>
171182 </note>
@@ -190,10 +201,9 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re
190201 progress does not affect the displayed totals. Also, the collector itself
191202 emits a new report at most once per <varname>PGSTAT_STAT_INTERVAL</varname>
192203 milliseconds (500 unless altered while building the server). So the
193- displayed information lags behind actual activity. Current-query
194- information is reported to the collector immediately, but is still subject
195- to the <varname>PGSTAT_STAT_INTERVAL</varname> delay before it becomes
196- visible.
204+ displayed information lags behind actual activity. However, current-query
205+ information collected by <varname>stats_command_string</varname> is
206+ always up-to-date.
197207 </para>
198208
199209 <para>
@@ -202,7 +212,10 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re
202212 the collector process and then continues to use this snapshot for all
203213 statistical views and functions until the end of its current transaction.
204214 So the statistics will appear not to change as long as you continue the
205- current transaction.
215+ current transaction. Similarly, information about the current queries of
216+ all processes is collected when any such information is first requested
217+ within a transaction, and the same information will be displayed throughout
218+ the transaction.
206219 This is a feature, not a bug, because it allows you to perform several
207220 queries on the statistics and correlate the results without worrying that
208221 the numbers are changing underneath you. But if you want to see new
@@ -232,9 +245,8 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re
232245 parameter <varname>stats_command_string</varname> has been
233246 turned on. Furthermore, these columns read as null unless the
234247 user examining the view is a superuser or the same as the user
235- owning the process being reported on. (Note that because of the
236- collector's reporting delay, the current query will only be
237- up-to-date for long-running queries.)</entry>
248+ owning the process being reported on.
249+ </entry>
238250 </row>
239251
240252 <row>
@@ -549,31 +561,32 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re
549561 <entry><literal><function>pg_stat_get_last_vacuum_time</function>(<type>oid</type>)</literal></entry>
550562 <entry><type>timestamptz</type></entry>
551563 <entry>
552- Time of the last vacuum initiated by the user
564+ Time of the last vacuum initiated by the user on this table
553565 </entry>
554566 </row>
555567
556568 <row>
557569 <entry><literal><function>pg_stat_get_last_autovacuum_time</function>(<type>oid</type>)</literal></entry>
558570 <entry><type>timestamptz</type></entry>
559571 <entry>
560- Time of the last vacuum initiated by the autovacuum daemon
572+ Time of the last vacuum initiated by the autovacuum daemon on this table
561573 </entry>
562574 </row>
563575
564576 <row>
565577 <entry><literal><function>pg_stat_get_last_analyze_time</function>(<type>oid</type>)</literal></entry>
566578 <entry><type>timestamptz</type></entry>
567579 <entry>
568- Time of the last analyze initiated by the user
580+ Time of the last analyze initiated by the user on this table
569581 </entry>
570582 </row>
571583
572584 <row>
573585 <entry><literal><function>pg_stat_get_last_autoanalyze_time</function>(<type>oid</type>)</literal></entry>
574586 <entry><type>timestamptz</type></entry>
575587 <entry>
576- Time of the last analyze initiated by the autovacuum daemon
588+ Time of the last analyze initiated by the autovacuum daemon on this
589+ table
577590 </entry>
578591 </row>
579592
@@ -677,7 +690,7 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re
677690 <entry><literal><function>pg_stat_reset</function>()</literal></entry>
678691 <entry><type>boolean</type></entry>
679692 <entry>
680- Reset allcurrently collected statistics
693+ Reset allblock-level and row-level statistics to zero
681694 </entry>
682695 </row>
683696 </tbody>