]> begriffs open source - ai-pg/blob - full-docs/html/progress-reporting.html
Include links to all subsection html pages, with shorter paths too
[ai-pg] / full-docs / html / progress-reporting.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>27.4. Progress Reporting</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-locks.html" title="27.3. Viewing Locks" /><link rel="next" href="dynamic-trace.html" title="27.5. Dynamic Tracing" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">27.4. Progress Reporting</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="monitoring-locks.html" title="27.3. Viewing Locks">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="monitoring.html" title="Chapter 27. Monitoring Database Activity">Up</a></td><th width="60%" align="center">Chapter 27. Monitoring Database Activity</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="dynamic-trace.html" title="27.5. Dynamic Tracing">Next</a></td></tr></table><hr /></div><div class="sect1" id="PROGRESS-REPORTING"><div class="titlepage"><div><div><h2 class="title" style="clear: both">27.4. Progress Reporting <a href="#PROGRESS-REPORTING" class="id_link">#</a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="sect2"><a href="progress-reporting.html#ANALYZE-PROGRESS-REPORTING">27.4.1. ANALYZE Progress Reporting</a></span></dt><dt><span class="sect2"><a href="progress-reporting.html#CLUSTER-PROGRESS-REPORTING">27.4.2. CLUSTER Progress Reporting</a></span></dt><dt><span class="sect2"><a href="progress-reporting.html#COPY-PROGRESS-REPORTING">27.4.3. COPY Progress Reporting</a></span></dt><dt><span class="sect2"><a href="progress-reporting.html#CREATE-INDEX-PROGRESS-REPORTING">27.4.4. CREATE INDEX Progress Reporting</a></span></dt><dt><span class="sect2"><a href="progress-reporting.html#VACUUM-PROGRESS-REPORTING">27.4.5. VACUUM Progress Reporting</a></span></dt><dt><span class="sect2"><a href="progress-reporting.html#BASEBACKUP-PROGRESS-REPORTING">27.4.6. Base Backup Progress Reporting</a></span></dt></dl></div><p>
3    <span class="productname">PostgreSQL</span> has the ability to report the progress of
4    certain commands during command execution.  Currently, the only commands
5    which support progress reporting are <code class="command">ANALYZE</code>,
6    <code class="command">CLUSTER</code>,
7    <code class="command">CREATE INDEX</code>, <code class="command">VACUUM</code>,
8    <code class="command">COPY</code>,
9    and <a class="xref" href="protocol-replication.html#PROTOCOL-REPLICATION-BASE-BACKUP">BASE_BACKUP</a> (i.e., replication
10    command that <a class="xref" href="app-pgbasebackup.html" title="pg_basebackup"><span class="refentrytitle"><span class="application">pg_basebackup</span></span></a> issues to take
11    a base backup).
12    This may be expanded in the future.
13   </p><div class="sect2" id="ANALYZE-PROGRESS-REPORTING"><div class="titlepage"><div><div><h3 class="title">27.4.1. ANALYZE Progress Reporting <a href="#ANALYZE-PROGRESS-REPORTING" class="id_link">#</a></h3></div></div></div><a id="id-1.6.14.9.3.2" class="indexterm"></a><p>
14    Whenever <code class="command">ANALYZE</code> is running, the
15    <code class="structname">pg_stat_progress_analyze</code> view will contain a
16    row for each backend that is currently running that command.  The tables
17    below describe the information that will be reported and provide
18    information about how to interpret it.
19   </p><div class="table" id="PG-STAT-PROGRESS-ANALYZE-VIEW"><p class="title"><strong>Table 27.38. <code class="structname">pg_stat_progress_analyze</code> View</strong></p><div class="table-contents"><table class="table" summary="pg_stat_progress_analyze View" border="1"><colgroup><col /></colgroup><thead><tr><th class="catalog_table_entry"><p class="column_definition">
20        Column Type
21       </p>
22       <p>
23        Description
24       </p></th></tr></thead><tbody><tr><td class="catalog_table_entry"><p class="column_definition">
25        <code class="structfield">pid</code> <code class="type">integer</code>
26       </p>
27       <p>
28        Process ID of backend.
29       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
30        <code class="structfield">datid</code> <code class="type">oid</code>
31       </p>
32       <p>
33        OID of the database to which this backend is connected.
34       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
35        <code class="structfield">datname</code> <code class="type">name</code>
36       </p>
37       <p>
38        Name of the database to which this backend is connected.
39       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
40        <code class="structfield">relid</code> <code class="type">oid</code>
41       </p>
42       <p>
43        OID of the table being analyzed.
44       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
45        <code class="structfield">phase</code> <code class="type">text</code>
46       </p>
47       <p>
48        Current processing phase. See <a class="xref" href="progress-reporting.html#ANALYZE-PHASES" title="Table 27.39. ANALYZE Phases">Table 27.39</a>.
49       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
50        <code class="structfield">sample_blks_total</code> <code class="type">bigint</code>
51       </p>
52       <p>
53        Total number of heap blocks that will be sampled.
54       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
55        <code class="structfield">sample_blks_scanned</code> <code class="type">bigint</code>
56       </p>
57       <p>
58        Number of heap blocks scanned.
59       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
60        <code class="structfield">ext_stats_total</code> <code class="type">bigint</code>
61       </p>
62       <p>
63        Number of extended statistics.
64       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
65        <code class="structfield">ext_stats_computed</code> <code class="type">bigint</code>
66       </p>
67       <p>
68        Number of extended statistics computed. This counter only advances
69        when the phase is <code class="literal">computing extended statistics</code>.
70       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
71        <code class="structfield">child_tables_total</code> <code class="type">bigint</code>
72       </p>
73       <p>
74        Number of child tables.
75       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
76        <code class="structfield">child_tables_done</code> <code class="type">bigint</code>
77       </p>
78       <p>
79        Number of child tables scanned. This counter only advances when the
80        phase is <code class="literal">acquiring inherited sample rows</code>.
81       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
82        <code class="structfield">current_child_table_relid</code> <code class="type">oid</code>
83       </p>
84       <p>
85        OID of the child table currently being scanned. This field is
86        only valid when the phase is
87        <code class="literal">acquiring inherited sample rows</code>.
88       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
89        <code class="structfield">delay_time</code> <code class="type">double precision</code>
90       </p>
91       <p>
92        Total time spent sleeping due to cost-based delay (see
93        <a class="xref" href="runtime-config-vacuum.html#RUNTIME-CONFIG-RESOURCE-VACUUM-COST" title="19.10.2. Cost-based Vacuum Delay">Section 19.10.2</a>, in milliseconds
94        (if <a class="xref" href="runtime-config-statistics.html#GUC-TRACK-COST-DELAY-TIMING">track_cost_delay_timing</a> is enabled, otherwise
95        zero).
96       </p></td></tr></tbody></table></div></div><br class="table-break" /><div class="table" id="ANALYZE-PHASES"><p class="title"><strong>Table 27.39. ANALYZE Phases</strong></p><div class="table-contents"><table class="table" summary="ANALYZE Phases" border="1"><colgroup><col class="col1" /><col class="col2" /></colgroup><thead><tr><th>Phase</th><th>Description</th></tr></thead><tbody><tr><td><code class="literal">initializing</code></td><td>
97        The command is preparing to begin scanning the heap.  This phase is
98        expected to be very brief.
99       </td></tr><tr><td><code class="literal">acquiring sample rows</code></td><td>
100        The command is currently scanning the table given by
101        <code class="structfield">relid</code> to obtain sample rows.
102       </td></tr><tr><td><code class="literal">acquiring inherited sample rows</code></td><td>
103        The command is currently scanning child tables to obtain sample rows.
104        Columns <code class="structfield">child_tables_total</code>,
105        <code class="structfield">child_tables_done</code>, and
106        <code class="structfield">current_child_table_relid</code> contain the
107        progress information for this phase.
108       </td></tr><tr><td><code class="literal">computing statistics</code></td><td>
109        The command is computing statistics from the sample rows obtained
110        during the table scan.
111       </td></tr><tr><td><code class="literal">computing extended statistics</code></td><td>
112        The command is computing extended statistics from the sample rows
113        obtained during the table scan.
114       </td></tr><tr><td><code class="literal">finalizing analyze</code></td><td>
115        The command is updating <code class="structname">pg_class</code>. When this
116        phase is completed, <code class="command">ANALYZE</code> will end.
117       </td></tr></tbody></table></div></div><br class="table-break" /><div class="note"><h3 class="title">Note</h3><p>
118     Note that when <code class="command">ANALYZE</code> is run on a partitioned table
119     without the <code class="literal">ONLY</code> keyword, all of its partitions are
120     also recursively analyzed.  In that case, <code class="command">ANALYZE</code>
121     progress is reported first for the parent table, whereby its inheritance
122     statistics are collected, followed by that for each partition.
123    </p></div></div><div class="sect2" id="CLUSTER-PROGRESS-REPORTING"><div class="titlepage"><div><div><h3 class="title">27.4.2. CLUSTER Progress Reporting <a href="#CLUSTER-PROGRESS-REPORTING" class="id_link">#</a></h3></div></div></div><a id="id-1.6.14.9.4.2" class="indexterm"></a><p>
124    Whenever <code class="command">CLUSTER</code> or <code class="command">VACUUM FULL</code> is
125    running, the <code class="structname">pg_stat_progress_cluster</code> view will
126    contain a row for each backend that is currently running either command.
127    The tables below describe the information that will be reported and
128    provide information about how to interpret it.
129   </p><div class="table" id="PG-STAT-PROGRESS-CLUSTER-VIEW"><p class="title"><strong>Table 27.40. <code class="structname">pg_stat_progress_cluster</code> View</strong></p><div class="table-contents"><table class="table" summary="pg_stat_progress_cluster View" border="1"><colgroup><col /></colgroup><thead><tr><th class="catalog_table_entry"><p class="column_definition">
130        Column Type
131       </p>
132       <p>
133        Description
134       </p></th></tr></thead><tbody><tr><td class="catalog_table_entry"><p class="column_definition">
135        <code class="structfield">pid</code> <code class="type">integer</code>
136       </p>
137       <p>
138        Process ID of backend.
139       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
140        <code class="structfield">datid</code> <code class="type">oid</code>
141       </p>
142       <p>
143        OID of the database to which this backend is connected.
144       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
145        <code class="structfield">datname</code> <code class="type">name</code>
146       </p>
147       <p>
148        Name of the database to which this backend is connected.
149       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
150        <code class="structfield">relid</code> <code class="type">oid</code>
151       </p>
152       <p>
153        OID of the table being clustered.
154       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
155        <code class="structfield">command</code> <code class="type">text</code>
156       </p>
157       <p>
158        The command that is running. Either <code class="literal">CLUSTER</code> or <code class="literal">VACUUM FULL</code>.
159       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
160        <code class="structfield">phase</code> <code class="type">text</code>
161       </p>
162       <p>
163        Current processing phase. See <a class="xref" href="progress-reporting.html#CLUSTER-PHASES" title="Table 27.41. CLUSTER and VACUUM FULL Phases">Table 27.41</a>.
164       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
165        <code class="structfield">cluster_index_relid</code> <code class="type">oid</code>
166       </p>
167       <p>
168        If the table is being scanned using an index, this is the OID of the
169        index being used; otherwise, it is zero.
170       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
171        <code class="structfield">heap_tuples_scanned</code> <code class="type">bigint</code>
172       </p>
173       <p>
174        Number of heap tuples scanned.
175        This counter only advances when the phase is
176        <code class="literal">seq scanning heap</code>,
177        <code class="literal">index scanning heap</code>
178        or <code class="literal">writing new heap</code>.
179       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
180        <code class="structfield">heap_tuples_written</code> <code class="type">bigint</code>
181       </p>
182       <p>
183        Number of heap tuples written.
184        This counter only advances when the phase is
185        <code class="literal">seq scanning heap</code>,
186        <code class="literal">index scanning heap</code>
187        or <code class="literal">writing new heap</code>.
188       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
189        <code class="structfield">heap_blks_total</code> <code class="type">bigint</code>
190       </p>
191       <p>
192        Total number of heap blocks in the table.  This number is reported
193        as of the beginning of <code class="literal">seq scanning heap</code>.
194       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
195        <code class="structfield">heap_blks_scanned</code> <code class="type">bigint</code>
196       </p>
197       <p>
198        Number of heap blocks scanned.  This counter only advances when the
199        phase is <code class="literal">seq scanning heap</code>.
200       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
201        <code class="structfield">index_rebuild_count</code> <code class="type">bigint</code>
202       </p>
203       <p>
204        Number of indexes rebuilt.  This counter only advances when the phase
205        is <code class="literal">rebuilding index</code>.
206       </p></td></tr></tbody></table></div></div><br class="table-break" /><div class="table" id="CLUSTER-PHASES"><p class="title"><strong>Table 27.41. CLUSTER and VACUUM FULL Phases</strong></p><div class="table-contents"><table class="table" summary="CLUSTER and VACUUM FULL Phases" border="1"><colgroup><col class="col1" /><col class="col2" /></colgroup><thead><tr><th>Phase</th><th>Description</th></tr></thead><tbody><tr><td><code class="literal">initializing</code></td><td>
207        The command is preparing to begin scanning the heap.  This phase is
208        expected to be very brief.
209      </td></tr><tr><td><code class="literal">seq scanning heap</code></td><td>
210        The command is currently scanning the table using a sequential scan.
211      </td></tr><tr><td><code class="literal">index scanning heap</code></td><td>
212        <code class="command">CLUSTER</code> is currently scanning the table using an index scan.
213      </td></tr><tr><td><code class="literal">sorting tuples</code></td><td>
214        <code class="command">CLUSTER</code> is currently sorting tuples.
215      </td></tr><tr><td><code class="literal">writing new heap</code></td><td>
216        <code class="command">CLUSTER</code> is currently writing the new heap.
217      </td></tr><tr><td><code class="literal">swapping relation files</code></td><td>
218        The command is currently swapping newly-built files into place.
219      </td></tr><tr><td><code class="literal">rebuilding index</code></td><td>
220        The command is currently rebuilding an index.
221      </td></tr><tr><td><code class="literal">performing final cleanup</code></td><td>
222        The command is performing final cleanup.  When this phase is
223        completed, <code class="command">CLUSTER</code>
224        or <code class="command">VACUUM FULL</code> will end.
225      </td></tr></tbody></table></div></div><br class="table-break" /></div><div class="sect2" id="COPY-PROGRESS-REPORTING"><div class="titlepage"><div><div><h3 class="title">27.4.3. COPY Progress Reporting <a href="#COPY-PROGRESS-REPORTING" class="id_link">#</a></h3></div></div></div><a id="id-1.6.14.9.5.2" class="indexterm"></a><p>
226    Whenever <code class="command">COPY</code> is running, the
227    <code class="structname">pg_stat_progress_copy</code> view will contain one row
228    for each backend that is currently running a <code class="command">COPY</code> command.
229    The table below describes the information that will be reported and provides
230    information about how to interpret it.
231   </p><div class="table" id="PG-STAT-PROGRESS-COPY-VIEW"><p class="title"><strong>Table 27.42. <code class="structname">pg_stat_progress_copy</code> View</strong></p><div class="table-contents"><table class="table" summary="pg_stat_progress_copy View" border="1"><colgroup><col /></colgroup><thead><tr><th class="catalog_table_entry"><p class="column_definition">
232        Column Type
233       </p>
234       <p>
235        Description
236       </p></th></tr></thead><tbody><tr><td class="catalog_table_entry"><p class="column_definition">
237        <code class="structfield">pid</code> <code class="type">integer</code>
238       </p>
239       <p>
240        Process ID of backend.
241       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
242        <code class="structfield">datid</code> <code class="type">oid</code>
243       </p>
244       <p>
245        OID of the database to which this backend is connected.
246       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
247        <code class="structfield">datname</code> <code class="type">name</code>
248       </p>
249       <p>
250        Name of the database to which this backend is connected.
251       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
252        <code class="structfield">relid</code> <code class="type">oid</code>
253       </p>
254       <p>
255        OID of the table on which the <code class="command">COPY</code> command is
256        executed. It is set to <code class="literal">0</code> if copying from a
257        <code class="command">SELECT</code> query.
258       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
259        <code class="structfield">command</code> <code class="type">text</code>
260       </p>
261       <p>
262        The command that is running: <code class="literal">COPY FROM</code>, or
263        <code class="literal">COPY TO</code>.
264       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
265        <code class="structfield">type</code> <code class="type">text</code>
266       </p>
267       <p>
268        The I/O type that the data is read from or written to:
269        <code class="literal">FILE</code>, <code class="literal">PROGRAM</code>,
270        <code class="literal">PIPE</code> (for <code class="command">COPY FROM STDIN</code> and
271        <code class="command">COPY TO STDOUT</code>), or <code class="literal">CALLBACK</code>
272        (used for example during the initial table synchronization in
273        logical replication).
274       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
275        <code class="structfield">bytes_processed</code> <code class="type">bigint</code>
276       </p>
277       <p>
278        Number of bytes already processed by <code class="command">COPY</code> command.
279       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
280        <code class="structfield">bytes_total</code> <code class="type">bigint</code>
281       </p>
282       <p>
283        Size of source file for <code class="command">COPY FROM</code> command in bytes.
284        It is set to <code class="literal">0</code> if not available.
285       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
286        <code class="structfield">tuples_processed</code> <code class="type">bigint</code>
287       </p>
288       <p>
289        Number of tuples already processed by <code class="command">COPY</code> command.
290       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
291        <code class="structfield">tuples_excluded</code> <code class="type">bigint</code>
292       </p>
293       <p>
294        Number of tuples not processed because they were excluded by the
295        <code class="command">WHERE</code> clause of the <code class="command">COPY</code> command.
296       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
297        <code class="structfield">tuples_skipped</code> <code class="type">bigint</code>
298       </p>
299       <p>
300        Number of tuples skipped because they contain malformed data.
301        This counter only advances when a value other than
302        <code class="literal">stop</code> is specified to the <code class="literal">ON_ERROR</code>
303        option.
304       </p></td></tr></tbody></table></div></div><br class="table-break" /></div><div class="sect2" id="CREATE-INDEX-PROGRESS-REPORTING"><div class="titlepage"><div><div><h3 class="title">27.4.4. CREATE INDEX Progress Reporting <a href="#CREATE-INDEX-PROGRESS-REPORTING" class="id_link">#</a></h3></div></div></div><a id="id-1.6.14.9.6.2" class="indexterm"></a><p>
305    Whenever <code class="command">CREATE INDEX</code> or <code class="command">REINDEX</code> is running, the
306    <code class="structname">pg_stat_progress_create_index</code> view will contain
307    one row for each backend that is currently creating indexes.  The tables
308    below describe the information that will be reported and provide information
309    about how to interpret it.
310   </p><div class="table" id="PG-STAT-PROGRESS-CREATE-INDEX-VIEW"><p class="title"><strong>Table 27.43. <code class="structname">pg_stat_progress_create_index</code> View</strong></p><div class="table-contents"><table class="table" summary="pg_stat_progress_create_index View" border="1"><colgroup><col /></colgroup><thead><tr><th class="catalog_table_entry"><p class="column_definition">
311        Column Type
312       </p>
313       <p>
314        Description
315       </p></th></tr></thead><tbody><tr><td class="catalog_table_entry"><p class="column_definition">
316        <code class="structfield">pid</code> <code class="type">integer</code>
317       </p>
318       <p>
319        Process ID of the backend creating indexes.
320       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
321        <code class="structfield">datid</code> <code class="type">oid</code>
322       </p>
323       <p>
324        OID of the database to which this backend is connected.
325       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
326        <code class="structfield">datname</code> <code class="type">name</code>
327       </p>
328       <p>
329        Name of the database to which this backend is connected.
330       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
331        <code class="structfield">relid</code> <code class="type">oid</code>
332       </p>
333       <p>
334        OID of the table on which the index is being created.
335       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
336        <code class="structfield">index_relid</code> <code class="type">oid</code>
337       </p>
338       <p>
339        OID of the index being created or reindexed.  During a
340        non-concurrent <code class="command">CREATE INDEX</code>, this is 0.
341       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
342        <code class="structfield">command</code> <code class="type">text</code>
343       </p>
344       <p>
345        Specific command type: <code class="literal">CREATE INDEX</code>,
346        <code class="literal">CREATE INDEX CONCURRENTLY</code>,
347        <code class="literal">REINDEX</code>, or <code class="literal">REINDEX CONCURRENTLY</code>.
348       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
349        <code class="structfield">phase</code> <code class="type">text</code>
350       </p>
351       <p>
352        Current processing phase of index creation.  See <a class="xref" href="progress-reporting.html#CREATE-INDEX-PHASES" title="Table 27.44. CREATE INDEX Phases">Table 27.44</a>.
353       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
354        <code class="structfield">lockers_total</code> <code class="type">bigint</code>
355       </p>
356       <p>
357        Total number of lockers to wait for, when applicable.
358       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
359        <code class="structfield">lockers_done</code> <code class="type">bigint</code>
360       </p>
361       <p>
362        Number of lockers already waited for.
363       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
364        <code class="structfield">current_locker_pid</code> <code class="type">bigint</code>
365       </p>
366       <p>
367        Process ID of the locker currently being waited for.
368       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
369        <code class="structfield">blocks_total</code> <code class="type">bigint</code>
370       </p>
371       <p>
372        Total number of blocks to be processed in the current phase.
373       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
374        <code class="structfield">blocks_done</code> <code class="type">bigint</code>
375       </p>
376       <p>
377        Number of blocks already processed in the current phase.
378       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
379        <code class="structfield">tuples_total</code> <code class="type">bigint</code>
380       </p>
381       <p>
382        Total number of tuples to be processed in the current phase.
383       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
384        <code class="structfield">tuples_done</code> <code class="type">bigint</code>
385       </p>
386       <p>
387        Number of tuples already processed in the current phase.
388       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
389        <code class="structfield">partitions_total</code> <code class="type">bigint</code>
390       </p>
391       <p>
392        Total number of partitions on which the index is to be created
393        or attached, including both direct and indirect partitions.
394        <code class="literal">0</code> during a <code class="literal">REINDEX</code>, or when
395        the index is not partitioned.
396       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
397        <code class="structfield">partitions_done</code> <code class="type">bigint</code>
398       </p>
399       <p>
400        Number of partitions on which the index has already been created
401        or attached, including both direct and indirect partitions.
402        <code class="literal">0</code> during a <code class="literal">REINDEX</code>, or when
403        the index is not partitioned.
404       </p></td></tr></tbody></table></div></div><br class="table-break" /><div class="table" id="CREATE-INDEX-PHASES"><p class="title"><strong>Table 27.44. CREATE INDEX Phases</strong></p><div class="table-contents"><table class="table" summary="CREATE INDEX Phases" border="1"><colgroup><col class="col1" /><col class="col2" /></colgroup><thead><tr><th>Phase</th><th>Description</th></tr></thead><tbody><tr><td><code class="literal">initializing</code></td><td>
405        <code class="command">CREATE INDEX</code> or <code class="command">REINDEX</code> is preparing to create the index.  This
406        phase is expected to be very brief.
407       </td></tr><tr><td><code class="literal">waiting for writers before build</code></td><td>
408        <code class="command">CREATE INDEX CONCURRENTLY</code> or <code class="command">REINDEX CONCURRENTLY</code> is waiting for transactions
409        with write locks that can potentially see the table to finish.
410        This phase is skipped when not in concurrent mode.
411        Columns <code class="structname">lockers_total</code>, <code class="structname">lockers_done</code>
412        and <code class="structname">current_locker_pid</code> contain the progress
413        information for this phase.
414       </td></tr><tr><td><code class="literal">building index</code></td><td>
415        The index is being built by the access method-specific code.  In this phase,
416        access methods that support progress reporting fill in their own progress data,
417        and the subphase is indicated in this column.  Typically,
418        <code class="structname">blocks_total</code> and <code class="structname">blocks_done</code>
419        will contain progress data, as well as potentially
420        <code class="structname">tuples_total</code> and <code class="structname">tuples_done</code>.
421       </td></tr><tr><td><code class="literal">waiting for writers before validation</code></td><td>
422        <code class="command">CREATE INDEX CONCURRENTLY</code> or <code class="command">REINDEX CONCURRENTLY</code> is waiting for transactions
423        with write locks that can potentially write into the table to finish.
424        This phase is skipped when not in concurrent mode.
425        Columns <code class="structname">lockers_total</code>, <code class="structname">lockers_done</code>
426        and <code class="structname">current_locker_pid</code> contain the progress
427        information for this phase.
428       </td></tr><tr><td><code class="literal">index validation: scanning index</code></td><td>
429        <code class="command">CREATE INDEX CONCURRENTLY</code> is scanning the index searching
430        for tuples that need to be validated.
431        This phase is skipped when not in concurrent mode.
432        Columns <code class="structname">blocks_total</code> (set to the total size of the index)
433        and <code class="structname">blocks_done</code> contain the progress information for this phase.
434       </td></tr><tr><td><code class="literal">index validation: sorting tuples</code></td><td>
435        <code class="command">CREATE INDEX CONCURRENTLY</code> is sorting the output of the
436        index scanning phase.
437       </td></tr><tr><td><code class="literal">index validation: scanning table</code></td><td>
438        <code class="command">CREATE INDEX CONCURRENTLY</code> is scanning the table
439        to validate the index tuples collected in the previous two phases.
440        This phase is skipped when not in concurrent mode.
441        Columns <code class="structname">blocks_total</code> (set to the total size of the table)
442        and <code class="structname">blocks_done</code> contain the progress information for this phase.
443       </td></tr><tr><td><code class="literal">waiting for old snapshots</code></td><td>
444        <code class="command">CREATE INDEX CONCURRENTLY</code> or <code class="command">REINDEX CONCURRENTLY</code> is waiting for transactions
445        that can potentially see the table to release their snapshots.  This
446        phase is skipped when not in concurrent mode.
447        Columns <code class="structname">lockers_total</code>, <code class="structname">lockers_done</code>
448        and <code class="structname">current_locker_pid</code> contain the progress
449        information for this phase.
450       </td></tr><tr><td><code class="literal">waiting for readers before marking dead</code></td><td>
451        <code class="command">REINDEX CONCURRENTLY</code> is waiting for transactions
452        with read locks on the table to finish, before marking the old index dead.
453        This phase is skipped when not in concurrent mode.
454        Columns <code class="structname">lockers_total</code>, <code class="structname">lockers_done</code>
455        and <code class="structname">current_locker_pid</code> contain the progress
456        information for this phase.
457       </td></tr><tr><td><code class="literal">waiting for readers before dropping</code></td><td>
458        <code class="command">REINDEX CONCURRENTLY</code> is waiting for transactions
459        with read locks on the table to finish, before dropping the old index.
460        This phase is skipped when not in concurrent mode.
461        Columns <code class="structname">lockers_total</code>, <code class="structname">lockers_done</code>
462        and <code class="structname">current_locker_pid</code> contain the progress
463        information for this phase.
464       </td></tr></tbody></table></div></div><br class="table-break" /></div><div class="sect2" id="VACUUM-PROGRESS-REPORTING"><div class="titlepage"><div><div><h3 class="title">27.4.5. VACUUM Progress Reporting <a href="#VACUUM-PROGRESS-REPORTING" class="id_link">#</a></h3></div></div></div><a id="id-1.6.14.9.7.2" class="indexterm"></a><p>
465    Whenever <code class="command">VACUUM</code> is running, the
466    <code class="structname">pg_stat_progress_vacuum</code> view will contain
467    one row for each backend (including autovacuum worker processes) that is
468    currently vacuuming.  The tables below describe the information
469    that will be reported and provide information about how to interpret it.
470    Progress for <code class="command">VACUUM FULL</code> commands is reported via
471    <code class="structname">pg_stat_progress_cluster</code>
472    because both <code class="command">VACUUM FULL</code> and <code class="command">CLUSTER</code>
473    rewrite the table, while regular <code class="command">VACUUM</code> only modifies it
474    in place. See <a class="xref" href="progress-reporting.html#CLUSTER-PROGRESS-REPORTING" title="27.4.2. CLUSTER Progress Reporting">Section 27.4.2</a>.
475   </p><div class="table" id="PG-STAT-PROGRESS-VACUUM-VIEW"><p class="title"><strong>Table 27.45. <code class="structname">pg_stat_progress_vacuum</code> View</strong></p><div class="table-contents"><table class="table" summary="pg_stat_progress_vacuum View" border="1"><colgroup><col /></colgroup><thead><tr><th class="catalog_table_entry"><p class="column_definition">
476        Column Type
477       </p>
478       <p>
479        Description
480       </p></th></tr></thead><tbody><tr><td class="catalog_table_entry"><p class="column_definition">
481        <code class="structfield">pid</code> <code class="type">integer</code>
482       </p>
483       <p>
484        Process ID of backend.
485       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
486        <code class="structfield">datid</code> <code class="type">oid</code>
487       </p>
488       <p>
489        OID of the database to which this backend is connected.
490       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
491        <code class="structfield">datname</code> <code class="type">name</code>
492       </p>
493       <p>
494        Name of the database to which this backend is connected.
495       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
496        <code class="structfield">relid</code> <code class="type">oid</code>
497       </p>
498       <p>
499        OID of the table being vacuumed.
500       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
501        <code class="structfield">phase</code> <code class="type">text</code>
502       </p>
503       <p>
504        Current processing phase of vacuum.  See <a class="xref" href="progress-reporting.html#VACUUM-PHASES" title="Table 27.46. VACUUM Phases">Table 27.46</a>.
505       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
506        <code class="structfield">heap_blks_total</code> <code class="type">bigint</code>
507       </p>
508       <p>
509        Total number of heap blocks in the table.  This number is reported
510        as of the beginning of the scan; blocks added later will not be (and
511        need not be) visited by this <code class="command">VACUUM</code>.
512       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
513        <code class="structfield">heap_blks_scanned</code> <code class="type">bigint</code>
514       </p>
515       <p>
516        Number of heap blocks scanned.  Because the
517        <a class="link" href="storage-vm.html" title="66.4. Visibility Map">visibility map</a> is used to optimize scans,
518        some blocks will be skipped without inspection; skipped blocks are
519        included in this total, so that this number will eventually become
520        equal to <code class="structfield">heap_blks_total</code> when the vacuum is complete.
521        This counter only advances when the phase is <code class="literal">scanning heap</code>.
522       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
523        <code class="structfield">heap_blks_vacuumed</code> <code class="type">bigint</code>
524       </p>
525       <p>
526        Number of heap blocks vacuumed.  Unless the table has no indexes, this
527        counter only advances when the phase is <code class="literal">vacuuming heap</code>.
528        Blocks that contain no dead tuples are skipped, so the counter may
529        sometimes skip forward in large increments.
530       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
531        <code class="structfield">index_vacuum_count</code> <code class="type">bigint</code>
532       </p>
533       <p>
534        Number of completed index vacuum cycles.
535       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
536        <code class="structfield">max_dead_tuple_bytes</code> <code class="type">bigint</code>
537       </p>
538       <p>
539        Amount of dead tuple data that we can store before needing to perform
540        an index vacuum cycle, based on
541        <a class="xref" href="runtime-config-resource.html#GUC-MAINTENANCE-WORK-MEM">maintenance_work_mem</a>.
542       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
543        <code class="structfield">dead_tuple_bytes</code> <code class="type">bigint</code>
544       </p>
545       <p>
546        Amount of dead tuple data collected since the last index vacuum cycle.
547       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
548       <code class="structfield">num_dead_item_ids</code> <code class="type">bigint</code>
549       </p>
550       <p>
551        Number of dead item identifiers collected since the last index vacuum cycle.
552       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
553        <code class="structfield">indexes_total</code> <code class="type">bigint</code>
554       </p>
555       <p>
556        Total number of indexes that will be vacuumed or cleaned up. This
557        number is reported at the beginning of the
558        <code class="literal">vacuuming indexes</code> phase or the
559        <code class="literal">cleaning up indexes</code> phase.
560       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
561        <code class="structfield">indexes_processed</code> <code class="type">bigint</code>
562       </p>
563       <p>
564        Number of indexes processed. This counter only advances when the
565        phase is <code class="literal">vacuuming indexes</code> or
566        <code class="literal">cleaning up indexes</code>.
567       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
568        <code class="structfield">delay_time</code> <code class="type">double precision</code>
569       </p>
570       <p>
571        Total time spent sleeping due to cost-based delay (see
572        <a class="xref" href="runtime-config-vacuum.html#RUNTIME-CONFIG-RESOURCE-VACUUM-COST" title="19.10.2. Cost-based Vacuum Delay">Section 19.10.2</a>), in milliseconds
573        (if <a class="xref" href="runtime-config-statistics.html#GUC-TRACK-COST-DELAY-TIMING">track_cost_delay_timing</a> is enabled, otherwise
574        zero).  This includes the time that any associated parallel workers have
575        slept.  However, parallel workers report their sleep time no more
576        frequently than once per second, so the reported value may be slightly
577        stale.
578       </p></td></tr></tbody></table></div></div><br class="table-break" /><div class="table" id="VACUUM-PHASES"><p class="title"><strong>Table 27.46. VACUUM Phases</strong></p><div class="table-contents"><table class="table" summary="VACUUM Phases" border="1"><colgroup><col class="col1" /><col class="col2" /></colgroup><thead><tr><th>Phase</th><th>Description</th></tr></thead><tbody><tr><td><code class="literal">initializing</code></td><td>
579        <code class="command">VACUUM</code> is preparing to begin scanning the heap.  This
580        phase is expected to be very brief.
581      </td></tr><tr><td><code class="literal">scanning heap</code></td><td>
582        <code class="command">VACUUM</code> is currently scanning the heap.  It will prune and
583        defragment each page if required, and possibly perform freezing
584        activity.  The <code class="structfield">heap_blks_scanned</code> column can be used
585        to monitor the progress of the scan.
586      </td></tr><tr><td><code class="literal">vacuuming indexes</code></td><td>
587        <code class="command">VACUUM</code> is currently vacuuming the indexes.  If a table has
588        any indexes, this will happen at least once per vacuum, after the heap
589        has been completely scanned.  It may happen multiple times per vacuum
590        if <a class="xref" href="runtime-config-resource.html#GUC-MAINTENANCE-WORK-MEM">maintenance_work_mem</a> (or, in the case of autovacuum,
591        <a class="xref" href="runtime-config-resource.html#GUC-AUTOVACUUM-WORK-MEM">autovacuum_work_mem</a> if set) is insufficient to store
592        the number of dead tuples found.
593      </td></tr><tr><td><code class="literal">vacuuming heap</code></td><td>
594        <code class="command">VACUUM</code> is currently vacuuming the heap.  Vacuuming the heap
595        is distinct from scanning the heap, and occurs after each instance of
596        vacuuming indexes.  If <code class="structfield">heap_blks_scanned</code> is less than
597        <code class="structfield">heap_blks_total</code>, the system will return to scanning
598        the heap after this phase is completed; otherwise, it will begin
599        cleaning up indexes after this phase is completed.
600      </td></tr><tr><td><code class="literal">cleaning up indexes</code></td><td>
601        <code class="command">VACUUM</code> is currently cleaning up indexes.  This occurs after
602        the heap has been completely scanned and all vacuuming of the indexes
603        and the heap has been completed.
604      </td></tr><tr><td><code class="literal">truncating heap</code></td><td>
605        <code class="command">VACUUM</code> is currently truncating the heap so as to return
606        empty pages at the end of the relation to the operating system.  This
607        occurs after cleaning up indexes.
608      </td></tr><tr><td><code class="literal">performing final cleanup</code></td><td>
609        <code class="command">VACUUM</code> is performing final cleanup.  During this phase,
610        <code class="command">VACUUM</code> will vacuum the free space map, update statistics
611        in <code class="literal">pg_class</code>, and report statistics to the cumulative
612        statistics system. When this phase is completed, <code class="command">VACUUM</code> will end.
613      </td></tr></tbody></table></div></div><br class="table-break" /></div><div class="sect2" id="BASEBACKUP-PROGRESS-REPORTING"><div class="titlepage"><div><div><h3 class="title">27.4.6. Base Backup Progress Reporting <a href="#BASEBACKUP-PROGRESS-REPORTING" class="id_link">#</a></h3></div></div></div><a id="id-1.6.14.9.8.2" class="indexterm"></a><p>
614    Whenever an application like <span class="application">pg_basebackup</span>
615    is taking a base backup, the
616    <code class="structname">pg_stat_progress_basebackup</code>
617    view will contain a row for each WAL sender process that is currently
618    running the <code class="command">BASE_BACKUP</code> replication command
619    and streaming the backup. The tables below describe the information
620    that will be reported and provide information about how to interpret it.
621   </p><div class="table" id="PG-STAT-PROGRESS-BASEBACKUP-VIEW"><p class="title"><strong>Table 27.47. <code class="structname">pg_stat_progress_basebackup</code> View</strong></p><div class="table-contents"><table class="table" summary="pg_stat_progress_basebackup View" border="1"><colgroup><col /></colgroup><thead><tr><th class="catalog_table_entry"><p class="column_definition">
622        Column Type
623       </p>
624       <p>
625        Description
626       </p></th></tr></thead><tbody><tr><td class="catalog_table_entry"><p class="column_definition">
627        <code class="structfield">pid</code> <code class="type">integer</code>
628       </p>
629       <p>
630        Process ID of a WAL sender process.
631       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
632        <code class="structfield">phase</code> <code class="type">text</code>
633       </p>
634       <p>
635        Current processing phase. See <a class="xref" href="progress-reporting.html#BASEBACKUP-PHASES" title="Table 27.48. Base Backup Phases">Table 27.48</a>.
636       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
637        <code class="structfield">backup_total</code> <code class="type">bigint</code>
638       </p>
639       <p>
640        Total amount of data that will be streamed. This is estimated and
641        reported as of the beginning of
642        <code class="literal">streaming database files</code> phase. Note that
643        this is only an approximation since the database
644        may change during <code class="literal">streaming database files</code> phase
645        and WAL log may be included in the backup later. This is always
646        the same value as <code class="structfield">backup_streamed</code>
647        once the amount of data streamed exceeds the estimated
648        total size. If the estimation is disabled in
649        <span class="application">pg_basebackup</span>
650        (i.e., <code class="literal">--no-estimate-size</code> option is specified),
651        this is <code class="literal">NULL</code>.
652       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
653        <code class="structfield">backup_streamed</code> <code class="type">bigint</code>
654       </p>
655       <p>
656        Amount of data streamed. This counter only advances
657        when the phase is <code class="literal">streaming database files</code> or
658        <code class="literal">transferring wal files</code>.
659       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
660        <code class="structfield">tablespaces_total</code> <code class="type">bigint</code>
661       </p>
662       <p>
663        Total number of tablespaces that will be streamed.
664       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
665        <code class="structfield">tablespaces_streamed</code> <code class="type">bigint</code>
666       </p>
667       <p>
668        Number of tablespaces streamed. This counter only
669        advances when the phase is <code class="literal">streaming database files</code>.
670       </p></td></tr></tbody></table></div></div><br class="table-break" /><div class="table" id="BASEBACKUP-PHASES"><p class="title"><strong>Table 27.48. Base Backup Phases</strong></p><div class="table-contents"><table class="table" summary="Base Backup Phases" border="1"><colgroup><col class="col1" /><col class="col2" /></colgroup><thead><tr><th>Phase</th><th>Description</th></tr></thead><tbody><tr><td><code class="literal">initializing</code></td><td>
671        The WAL sender process is preparing to begin the backup.
672        This phase is expected to be very brief.
673       </td></tr><tr><td><code class="literal">waiting for checkpoint to finish</code></td><td>
674        The WAL sender process is currently performing
675        <code class="function">pg_backup_start</code> to prepare to
676        take a base backup, and waiting for the start-of-backup
677        checkpoint to finish.
678       </td></tr><tr><td><code class="literal">estimating backup size</code></td><td>
679        The WAL sender process is currently estimating the total amount
680        of database files that will be streamed as a base backup.
681       </td></tr><tr><td><code class="literal">streaming database files</code></td><td>
682        The WAL sender process is currently streaming database files
683        as a base backup.
684       </td></tr><tr><td><code class="literal">waiting for wal archiving to finish</code></td><td>
685        The WAL sender process is currently performing
686        <code class="function">pg_backup_stop</code> to finish the backup,
687        and waiting for all the WAL files required for the base backup
688        to be successfully archived.
689        If either <code class="literal">--wal-method=none</code> or
690        <code class="literal">--wal-method=stream</code> is specified in
691        <span class="application">pg_basebackup</span>, the backup will end
692        when this phase is completed.
693       </td></tr><tr><td><code class="literal">transferring wal files</code></td><td>
694        The WAL sender process is currently transferring all WAL logs
695        generated during the backup. This phase occurs after
696        <code class="literal">waiting for wal archiving to finish</code> phase if
697        <code class="literal">--wal-method=fetch</code> is specified in
698        <span class="application">pg_basebackup</span>. The backup will end
699        when this phase is completed.
700       </td></tr></tbody></table></div></div><br class="table-break" /></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="monitoring-locks.html" title="27.3. Viewing Locks">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="monitoring.html" title="Chapter 27. Monitoring Database Activity">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="dynamic-trace.html" title="27.5. Dynamic Tracing">Next</a></td></tr><tr><td width="40%" align="left" valign="top">27.3. Viewing Locks </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="40%" align="right" valign="top"> 27.5. Dynamic Tracing</td></tr></table></div></body></html>