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 $ -->
2
2
3
3
<chapter id="monitoring">
4
4
<title>Monitoring Database Activity</title>
@@ -109,9 +109,14 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re
109
109
<productname>PostgreSQL</productname>'s <firstterm>statistics collector</>
110
110
is a subsystem that supports collection and reporting of information about
111
111
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.
115
120
</para>
116
121
117
122
<sect2 id="monitoring-stats-setup">
@@ -136,15 +141,21 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re
136
141
</para>
137
142
138
143
<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
141
145
linkend="guc-stats-row-level"> control how much information is
142
146
actually sent to the collector and thus determine how much run-time
143
147
overhead occurs. These respectively determine whether a server
144
- process sends its current command string, disk-block-level access
145
- statistics, and row-level access statistics to the collector.
148
+ process tracks disk-block-level access
149
+ statistics and row-level access statistics and sends these to the collector.
146
150
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.
148
159
</para>
149
160
150
161
<para>
@@ -165,7 +176,7 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re
165
176
very few statistics are collected in the default
166
177
configuration. Enabling one or more of these configuration
167
178
variables will significantly enhance the amount of useful data
168
- produced by the statistics collector , at the expense of
179
+ produced by the statistics facilities , at the expense of
169
180
additional run-time overhead.
170
181
</para>
171
182
</note>
@@ -190,10 +201,9 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re
190
201
progress does not affect the displayed totals. Also, the collector itself
191
202
emits a new report at most once per <varname>PGSTAT_STAT_INTERVAL</varname>
192
203
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.
197
207
</para>
198
208
199
209
<para>
@@ -202,7 +212,10 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re
202
212
the collector process and then continues to use this snapshot for all
203
213
statistical views and functions until the end of its current transaction.
204
214
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.
206
219
This is a feature, not a bug, because it allows you to perform several
207
220
queries on the statistics and correlate the results without worrying that
208
221
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
232
245
parameter <varname>stats_command_string</varname> has been
233
246
turned on. Furthermore, these columns read as null unless the
234
247
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>
238
250
</row>
239
251
240
252
<row>
@@ -549,31 +561,32 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re
549
561
<entry><literal><function>pg_stat_get_last_vacuum_time</function>(<type>oid</type>)</literal></entry>
550
562
<entry><type>timestamptz</type></entry>
551
563
<entry>
552
- Time of the last vacuum initiated by the user
564
+ Time of the last vacuum initiated by the user on this table
553
565
</entry>
554
566
</row>
555
567
556
568
<row>
557
569
<entry><literal><function>pg_stat_get_last_autovacuum_time</function>(<type>oid</type>)</literal></entry>
558
570
<entry><type>timestamptz</type></entry>
559
571
<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
561
573
</entry>
562
574
</row>
563
575
564
576
<row>
565
577
<entry><literal><function>pg_stat_get_last_analyze_time</function>(<type>oid</type>)</literal></entry>
566
578
<entry><type>timestamptz</type></entry>
567
579
<entry>
568
- Time of the last analyze initiated by the user
580
+ Time of the last analyze initiated by the user on this table
569
581
</entry>
570
582
</row>
571
583
572
584
<row>
573
585
<entry><literal><function>pg_stat_get_last_autoanalyze_time</function>(<type>oid</type>)</literal></entry>
574
586
<entry><type>timestamptz</type></entry>
575
587
<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
577
590
</entry>
578
591
</row>
579
592
@@ -677,7 +690,7 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re
677
690
<entry><literal><function>pg_stat_reset</function>()</literal></entry>
678
691
<entry><type>boolean</type></entry>
679
692
<entry>
680
- Reset all currently collected statistics
693
+ Reset all block-level and row-level statistics to zero
681
694
</entry>
682
695
</row>
683
696
</tbody>
0 commit comments