Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
progress-reporting.html653 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.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="28.3. Viewing Locks" /><link rel="next" href="dynamic-trace.html" title="28.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">28.4. Progress Reporting</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="monitoring-locks.html" title="28.3. Viewing Locks">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="dynamic-trace.html" title="28.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">28.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">28.4.1. ANALYZE Progress Reporting</a></span></dt><dt><span class="sect2"><a href="progress-reporting.html#CLUSTER-PROGRESS-REPORTING">28.4.2. CLUSTER Progress Reporting</a></span></dt><dt><span class="sect2"><a href="progress-reporting.html#COPY-PROGRESS-REPORTING">28.4.3. COPY Progress Reporting</a></span></dt><dt><span class="sect2"><a href="progress-reporting.html#CREATE-INDEX-PROGRESS-REPORTING">28.4.4. CREATE INDEX Progress Reporting</a></span></dt><dt><span class="sect2"><a href="progress-reporting.html#VACUUM-PROGRESS-REPORTING">28.4.5. VACUUM Progress Reporting</a></span></dt><dt><span class="sect2"><a href="progress-reporting.html#BASEBACKUP-PROGRESS-REPORTING">28.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 of4   certain commands during command execution.  Currently, the only commands5   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., replication10   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 take11   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">28.4.1. ANALYZE Progress Reporting <a href="#ANALYZE-PROGRESS-REPORTING" class="id_link">#</a></h3></div></div></div><a id="id-1.6.15.9.3.2" class="indexterm"></a><p>14   Whenever <code class="command">ANALYZE</code> is running, the15   <code class="structname">pg_stat_progress_analyze</code> view will contain a16   row for each backend that is currently running that command.  The tables17   below describe the information that will be reported and provide18   information about how to interpret it.19  </p><div class="table" id="PG-STAT-PROGRESS-ANALYZE-VIEW"><p class="title"><strong>Table 28.37. <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 Type21      </p>22      <p>23       Description24      </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 28.38. ANALYZE Phases">Table 28.38</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 advances69       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 the80       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 is86       only valid when the phase is87       <code class="literal">acquiring inherited sample rows</code>.88      </p></td></tr></tbody></table></div></div><br class="table-break" /><div class="table" id="ANALYZE-PHASES"><p class="title"><strong>Table 28.38. 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>89       The command is preparing to begin scanning the heap.  This phase is90       expected to be very brief.91      </td></tr><tr><td><code class="literal">acquiring sample rows</code></td><td>92       The command is currently scanning the table given by93       <code class="structfield">relid</code> to obtain sample rows.94      </td></tr><tr><td><code class="literal">acquiring inherited sample rows</code></td><td>95       The command is currently scanning child tables to obtain sample rows.96       Columns <code class="structfield">child_tables_total</code>,97       <code class="structfield">child_tables_done</code>, and98       <code class="structfield">current_child_table_relid</code> contain the99       progress information for this phase.100      </td></tr><tr><td><code class="literal">computing statistics</code></td><td>101       The command is computing statistics from the sample rows obtained102       during the table scan.103      </td></tr><tr><td><code class="literal">computing extended statistics</code></td><td>104       The command is computing extended statistics from the sample rows105       obtained during the table scan.106      </td></tr><tr><td><code class="literal">finalizing analyze</code></td><td>107       The command is updating <code class="structname">pg_class</code>. When this108       phase is completed, <code class="command">ANALYZE</code> will end.109      </td></tr></tbody></table></div></div><br class="table-break" /><div class="note"><h3 class="title">Note</h3><p>110    Note that when <code class="command">ANALYZE</code> is run on a partitioned table,111    all of its partitions are also recursively analyzed.112    In that case, <code class="command">ANALYZE</code>113    progress is reported first for the parent table, whereby its inheritance114    statistics are collected, followed by that for each partition.115   </p></div></div><div class="sect2" id="CLUSTER-PROGRESS-REPORTING"><div class="titlepage"><div><div><h3 class="title">28.4.2. CLUSTER Progress Reporting <a href="#CLUSTER-PROGRESS-REPORTING" class="id_link">#</a></h3></div></div></div><a id="id-1.6.15.9.4.2" class="indexterm"></a><p>116   Whenever <code class="command">CLUSTER</code> or <code class="command">VACUUM FULL</code> is117   running, the <code class="structname">pg_stat_progress_cluster</code> view will118   contain a row for each backend that is currently running either command.119   The tables below describe the information that will be reported and120   provide information about how to interpret it.121  </p><div class="table" id="PG-STAT-PROGRESS-CLUSTER-VIEW"><p class="title"><strong>Table 28.39. <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">122       Column Type123      </p>124      <p>125       Description126      </p></th></tr></thead><tbody><tr><td class="catalog_table_entry"><p class="column_definition">127       <code class="structfield">pid</code> <code class="type">integer</code>128      </p>129      <p>130       Process ID of backend.131      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">132       <code class="structfield">datid</code> <code class="type">oid</code>133      </p>134      <p>135       OID of the database to which this backend is connected.136      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">137       <code class="structfield">datname</code> <code class="type">name</code>138      </p>139      <p>140       Name of the database to which this backend is connected.141      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">142       <code class="structfield">relid</code> <code class="type">oid</code>143      </p>144      <p>145       OID of the table being clustered.146      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">147       <code class="structfield">command</code> <code class="type">text</code>148      </p>149      <p>150       The command that is running. Either <code class="literal">CLUSTER</code> or <code class="literal">VACUUM FULL</code>.151      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">152       <code class="structfield">phase</code> <code class="type">text</code>153      </p>154      <p>155       Current processing phase. See <a class="xref" href="progress-reporting.html#CLUSTER-PHASES" title="Table 28.40. CLUSTER and VACUUM FULL Phases">Table 28.40</a>.156      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">157       <code class="structfield">cluster_index_relid</code> <code class="type">oid</code>158      </p>159      <p>160       If the table is being scanned using an index, this is the OID of the161       index being used; otherwise, it is zero.162      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">163       <code class="structfield">heap_tuples_scanned</code> <code class="type">bigint</code>164      </p>165      <p>166       Number of heap tuples scanned.167       This counter only advances when the phase is168       <code class="literal">seq scanning heap</code>,169       <code class="literal">index scanning heap</code>170       or <code class="literal">writing new heap</code>.171      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">172       <code class="structfield">heap_tuples_written</code> <code class="type">bigint</code>173      </p>174      <p>175       Number of heap tuples written.176       This counter only advances when the phase is177       <code class="literal">seq scanning heap</code>,178       <code class="literal">index scanning heap</code>179       or <code class="literal">writing new heap</code>.180      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">181       <code class="structfield">heap_blks_total</code> <code class="type">bigint</code>182      </p>183      <p>184       Total number of heap blocks in the table.  This number is reported185       as of the beginning of <code class="literal">seq scanning heap</code>.186      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">187       <code class="structfield">heap_blks_scanned</code> <code class="type">bigint</code>188      </p>189      <p>190       Number of heap blocks scanned.  This counter only advances when the191       phase is <code class="literal">seq scanning heap</code>.192      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">193       <code class="structfield">index_rebuild_count</code> <code class="type">bigint</code>194      </p>195      <p>196       Number of indexes rebuilt.  This counter only advances when the phase197       is <code class="literal">rebuilding index</code>.198      </p></td></tr></tbody></table></div></div><br class="table-break" /><div class="table" id="CLUSTER-PHASES"><p class="title"><strong>Table 28.40. 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>199       The command is preparing to begin scanning the heap.  This phase is200       expected to be very brief.201     </td></tr><tr><td><code class="literal">seq scanning heap</code></td><td>202       The command is currently scanning the table using a sequential scan.203     </td></tr><tr><td><code class="literal">index scanning heap</code></td><td>204       <code class="command">CLUSTER</code> is currently scanning the table using an index scan.205     </td></tr><tr><td><code class="literal">sorting tuples</code></td><td>206       <code class="command">CLUSTER</code> is currently sorting tuples.207     </td></tr><tr><td><code class="literal">writing new heap</code></td><td>208       <code class="command">CLUSTER</code> is currently writing the new heap.209     </td></tr><tr><td><code class="literal">swapping relation files</code></td><td>210       The command is currently swapping newly-built files into place.211     </td></tr><tr><td><code class="literal">rebuilding index</code></td><td>212       The command is currently rebuilding an index.213     </td></tr><tr><td><code class="literal">performing final cleanup</code></td><td>214       The command is performing final cleanup.  When this phase is215       completed, <code class="command">CLUSTER</code>216       or <code class="command">VACUUM FULL</code> will end.217     </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">28.4.3. COPY Progress Reporting <a href="#COPY-PROGRESS-REPORTING" class="id_link">#</a></h3></div></div></div><a id="id-1.6.15.9.5.2" class="indexterm"></a><p>218   Whenever <code class="command">COPY</code> is running, the219   <code class="structname">pg_stat_progress_copy</code> view will contain one row220   for each backend that is currently running a <code class="command">COPY</code> command.221   The table below describes the information that will be reported and provides222   information about how to interpret it.223  </p><div class="table" id="PG-STAT-PROGRESS-COPY-VIEW"><p class="title"><strong>Table 28.41. <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">224       Column Type225      </p>226      <p>227       Description228      </p></th></tr></thead><tbody><tr><td class="catalog_table_entry"><p class="column_definition">229       <code class="structfield">pid</code> <code class="type">integer</code>230      </p>231      <p>232       Process ID of backend.233      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">234       <code class="structfield">datid</code> <code class="type">oid</code>235      </p>236      <p>237       OID of the database to which this backend is connected.238      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">239       <code class="structfield">datname</code> <code class="type">name</code>240      </p>241      <p>242       Name of the database to which this backend is connected.243      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">244       <code class="structfield">relid</code> <code class="type">oid</code>245      </p>246      <p>247       OID of the table on which the <code class="command">COPY</code> command is248       executed. It is set to <code class="literal">0</code> if copying from a249       <code class="command">SELECT</code> query.250      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">251       <code class="structfield">command</code> <code class="type">text</code>252      </p>253      <p>254       The command that is running: <code class="literal">COPY FROM</code>, or255       <code class="literal">COPY TO</code>.256      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">257       <code class="structfield">type</code> <code class="type">text</code>258      </p>259      <p>260       The io type that the data is read from or written to:261       <code class="literal">FILE</code>, <code class="literal">PROGRAM</code>,262       <code class="literal">PIPE</code> (for <code class="command">COPY FROM STDIN</code> and263       <code class="command">COPY TO STDOUT</code>), or <code class="literal">CALLBACK</code>264       (used for example during the initial table synchronization in265       logical replication).266      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">267       <code class="structfield">bytes_processed</code> <code class="type">bigint</code>268      </p>269      <p>270       Number of bytes already processed by <code class="command">COPY</code> command.271      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">272       <code class="structfield">bytes_total</code> <code class="type">bigint</code>273      </p>274      <p>275       Size of source file for <code class="command">COPY FROM</code> command in bytes.276       It is set to <code class="literal">0</code> if not available.277      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">278       <code class="structfield">tuples_processed</code> <code class="type">bigint</code>279      </p>280      <p>281       Number of tuples already processed by <code class="command">COPY</code> command.282      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">283       <code class="structfield">tuples_excluded</code> <code class="type">bigint</code>284      </p>285      <p>286       Number of tuples not processed because they were excluded by the287       <code class="command">WHERE</code> clause of the <code class="command">COPY</code> command.288      </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">28.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.15.9.6.2" class="indexterm"></a><p>289   Whenever <code class="command">CREATE INDEX</code> or <code class="command">REINDEX</code> is running, the290   <code class="structname">pg_stat_progress_create_index</code> view will contain291   one row for each backend that is currently creating indexes.  The tables292   below describe the information that will be reported and provide information293   about how to interpret it.294  </p><div class="table" id="PG-STAT-PROGRESS-CREATE-INDEX-VIEW"><p class="title"><strong>Table 28.42. <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">295       Column Type296      </p>297      <p>298       Description299      </p></th></tr></thead><tbody><tr><td class="catalog_table_entry"><p class="column_definition">300       <code class="structfield">pid</code> <code class="type">integer</code>301      </p>302      <p>303       Process ID of the backend creating indexes.304      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">305       <code class="structfield">datid</code> <code class="type">oid</code>306      </p>307      <p>308       OID of the database to which this backend is connected.309      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">310       <code class="structfield">datname</code> <code class="type">name</code>311      </p>312      <p>313       Name of the database to which this backend is connected.314      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">315       <code class="structfield">relid</code> <code class="type">oid</code>316      </p>317      <p>318       OID of the table on which the index is being created.319      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">320       <code class="structfield">index_relid</code> <code class="type">oid</code>321      </p>322      <p>323       OID of the index being created or reindexed.  During a324       non-concurrent <code class="command">CREATE INDEX</code>, this is 0.325      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">326       <code class="structfield">command</code> <code class="type">text</code>327      </p>328      <p>329       Specific command type: <code class="literal">CREATE INDEX</code>,330       <code class="literal">CREATE INDEX CONCURRENTLY</code>,331       <code class="literal">REINDEX</code>, or <code class="literal">REINDEX CONCURRENTLY</code>.332      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">333       <code class="structfield">phase</code> <code class="type">text</code>334      </p>335      <p>336       Current processing phase of index creation.  See <a class="xref" href="progress-reporting.html#CREATE-INDEX-PHASES" title="Table 28.43. CREATE INDEX Phases">Table 28.43</a>.337      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">338       <code class="structfield">lockers_total</code> <code class="type">bigint</code>339      </p>340      <p>341       Total number of lockers to wait for, when applicable.342      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">343       <code class="structfield">lockers_done</code> <code class="type">bigint</code>344      </p>345      <p>346       Number of lockers already waited for.347      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">348       <code class="structfield">current_locker_pid</code> <code class="type">bigint</code>349      </p>350      <p>351       Process ID of the locker currently being waited for.352      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">353       <code class="structfield">blocks_total</code> <code class="type">bigint</code>354      </p>355      <p>356       Total number of blocks to be processed in the current phase.357      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">358       <code class="structfield">blocks_done</code> <code class="type">bigint</code>359      </p>360      <p>361       Number of blocks already processed in the current phase.362      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">363       <code class="structfield">tuples_total</code> <code class="type">bigint</code>364      </p>365      <p>366       Total number of tuples to be processed in the current phase.367      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">368       <code class="structfield">tuples_done</code> <code class="type">bigint</code>369      </p>370      <p>371       Number of tuples already processed in the current phase.372      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">373       <code class="structfield">partitions_total</code> <code class="type">bigint</code>374      </p>375      <p>376       Total number of partitions on which the index is to be created377       or attached, including both direct and indirect partitions.378       <code class="literal">0</code> during a <code class="literal">REINDEX</code>, or when379       the index is not partitioned.380      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">381       <code class="structfield">partitions_done</code> <code class="type">bigint</code>382      </p>383      <p>384       Number of partitions on which the index has already been created385       or attached, including both direct and indirect partitions.386       <code class="literal">0</code> during a <code class="literal">REINDEX</code>, or when387       the index is not partitioned.388      </p></td></tr></tbody></table></div></div><br class="table-break" /><div class="table" id="CREATE-INDEX-PHASES"><p class="title"><strong>Table 28.43. 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>389       <code class="command">CREATE INDEX</code> or <code class="command">REINDEX</code> is preparing to create the index.  This390       phase is expected to be very brief.391      </td></tr><tr><td><code class="literal">waiting for writers before build</code></td><td>392       <code class="command">CREATE INDEX CONCURRENTLY</code> or <code class="command">REINDEX CONCURRENTLY</code> is waiting for transactions393       with write locks that can potentially see the table to finish.394       This phase is skipped when not in concurrent mode.395       Columns <code class="structname">lockers_total</code>, <code class="structname">lockers_done</code>396       and <code class="structname">current_locker_pid</code> contain the progress397       information for this phase.398      </td></tr><tr><td><code class="literal">building index</code></td><td>399       The index is being built by the access method-specific code.  In this phase,400       access methods that support progress reporting fill in their own progress data,401       and the subphase is indicated in this column.  Typically,402       <code class="structname">blocks_total</code> and <code class="structname">blocks_done</code>403       will contain progress data, as well as potentially404       <code class="structname">tuples_total</code> and <code class="structname">tuples_done</code>.405      </td></tr><tr><td><code class="literal">waiting for writers before validation</code></td><td>406       <code class="command">CREATE INDEX CONCURRENTLY</code> or <code class="command">REINDEX CONCURRENTLY</code> is waiting for transactions407       with write locks that can potentially write into the table to finish.408       This phase is skipped when not in concurrent mode.409       Columns <code class="structname">lockers_total</code>, <code class="structname">lockers_done</code>410       and <code class="structname">current_locker_pid</code> contain the progress411       information for this phase.412      </td></tr><tr><td><code class="literal">index validation: scanning index</code></td><td>413       <code class="command">CREATE INDEX CONCURRENTLY</code> is scanning the index searching414       for tuples that need to be validated.415       This phase is skipped when not in concurrent mode.416       Columns <code class="structname">blocks_total</code> (set to the total size of the index)417       and <code class="structname">blocks_done</code> contain the progress information for this phase.418      </td></tr><tr><td><code class="literal">index validation: sorting tuples</code></td><td>419       <code class="command">CREATE INDEX CONCURRENTLY</code> is sorting the output of the420       index scanning phase.421      </td></tr><tr><td><code class="literal">index validation: scanning table</code></td><td>422       <code class="command">CREATE INDEX CONCURRENTLY</code> is scanning the table423       to validate the index tuples collected in the previous two phases.424       This phase is skipped when not in concurrent mode.425       Columns <code class="structname">blocks_total</code> (set to the total size of the table)426       and <code class="structname">blocks_done</code> contain the progress information for this phase.427      </td></tr><tr><td><code class="literal">waiting for old snapshots</code></td><td>428       <code class="command">CREATE INDEX CONCURRENTLY</code> or <code class="command">REINDEX CONCURRENTLY</code> is waiting for transactions429       that can potentially see the table to release their snapshots.  This430       phase is skipped when not in concurrent mode.431       Columns <code class="structname">lockers_total</code>, <code class="structname">lockers_done</code>432       and <code class="structname">current_locker_pid</code> contain the progress433       information for this phase.434      </td></tr><tr><td><code class="literal">waiting for readers before marking dead</code></td><td>435       <code class="command">REINDEX CONCURRENTLY</code> is waiting for transactions436       with read locks on the table to finish, before marking the old index dead.437       This phase is skipped when not in concurrent mode.438       Columns <code class="structname">lockers_total</code>, <code class="structname">lockers_done</code>439       and <code class="structname">current_locker_pid</code> contain the progress440       information for this phase.441      </td></tr><tr><td><code class="literal">waiting for readers before dropping</code></td><td>442       <code class="command">REINDEX CONCURRENTLY</code> is waiting for transactions443       with read locks on the table to finish, before dropping the old index.444       This phase is skipped when not in concurrent mode.445       Columns <code class="structname">lockers_total</code>, <code class="structname">lockers_done</code>446       and <code class="structname">current_locker_pid</code> contain the progress447       information for this phase.448      </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">28.4.5. VACUUM Progress Reporting <a href="#VACUUM-PROGRESS-REPORTING" class="id_link">#</a></h3></div></div></div><a id="id-1.6.15.9.7.2" class="indexterm"></a><p>449   Whenever <code class="command">VACUUM</code> is running, the450   <code class="structname">pg_stat_progress_vacuum</code> view will contain451   one row for each backend (including autovacuum worker processes) that is452   currently vacuuming.  The tables below describe the information453   that will be reported and provide information about how to interpret it.454   Progress for <code class="command">VACUUM FULL</code> commands is reported via455   <code class="structname">pg_stat_progress_cluster</code>456   because both <code class="command">VACUUM FULL</code> and <code class="command">CLUSTER</code>457   rewrite the table, while regular <code class="command">VACUUM</code> only modifies it458   in place. See <a class="xref" href="progress-reporting.html#CLUSTER-PROGRESS-REPORTING" title="28.4.2. CLUSTER Progress Reporting">Section 28.4.2</a>.459  </p><div class="table" id="PG-STAT-PROGRESS-VACUUM-VIEW"><p class="title"><strong>Table 28.44. <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">460       Column Type461      </p>462      <p>463       Description464      </p></th></tr></thead><tbody><tr><td class="catalog_table_entry"><p class="column_definition">465       <code class="structfield">pid</code> <code class="type">integer</code>466      </p>467      <p>468       Process ID of backend.469      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">470       <code class="structfield">datid</code> <code class="type">oid</code>471      </p>472      <p>473       OID of the database to which this backend is connected.474      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">475       <code class="structfield">datname</code> <code class="type">name</code>476      </p>477      <p>478       Name of the database to which this backend is connected.479      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">480       <code class="structfield">relid</code> <code class="type">oid</code>481      </p>482      <p>483       OID of the table being vacuumed.484      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">485       <code class="structfield">phase</code> <code class="type">text</code>486      </p>487      <p>488       Current processing phase of vacuum.  See <a class="xref" href="progress-reporting.html#VACUUM-PHASES" title="Table 28.45. VACUUM Phases">Table 28.45</a>.489      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">490       <code class="structfield">heap_blks_total</code> <code class="type">bigint</code>491      </p>492      <p>493       Total number of heap blocks in the table.  This number is reported494       as of the beginning of the scan; blocks added later will not be (and495       need not be) visited by this <code class="command">VACUUM</code>.496      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">497       <code class="structfield">heap_blks_scanned</code> <code class="type">bigint</code>498      </p>499      <p>500       Number of heap blocks scanned.  Because the501       <a class="link" href="storage-vm.html" title="73.4. Visibility Map">visibility map</a> is used to optimize scans,502       some blocks will be skipped without inspection; skipped blocks are503       included in this total, so that this number will eventually become504       equal to <code class="structfield">heap_blks_total</code> when the vacuum is complete.505       This counter only advances when the phase is <code class="literal">scanning heap</code>.506      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">507       <code class="structfield">heap_blks_vacuumed</code> <code class="type">bigint</code>508      </p>509      <p>510       Number of heap blocks vacuumed.  Unless the table has no indexes, this511       counter only advances when the phase is <code class="literal">vacuuming heap</code>.512       Blocks that contain no dead tuples are skipped, so the counter may513       sometimes skip forward in large increments.514      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">515       <code class="structfield">index_vacuum_count</code> <code class="type">bigint</code>516      </p>517      <p>518       Number of completed index vacuum cycles.519      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">520       <code class="structfield">max_dead_tuples</code> <code class="type">bigint</code>521      </p>522      <p>523       Number of dead tuples that we can store before needing to perform524       an index vacuum cycle, based on525       <a class="xref" href="runtime-config-resource.html#GUC-MAINTENANCE-WORK-MEM">maintenance_work_mem</a>.526      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">527       <code class="structfield">num_dead_tuples</code> <code class="type">bigint</code>528      </p>529      <p>530       Number of dead tuples collected since the last index vacuum cycle.531      </p></td></tr></tbody></table></div></div><br class="table-break" /><div class="table" id="VACUUM-PHASES"><p class="title"><strong>Table 28.45. 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>532       <code class="command">VACUUM</code> is preparing to begin scanning the heap.  This533       phase is expected to be very brief.534     </td></tr><tr><td><code class="literal">scanning heap</code></td><td>535       <code class="command">VACUUM</code> is currently scanning the heap.  It will prune and536       defragment each page if required, and possibly perform freezing537       activity.  The <code class="structfield">heap_blks_scanned</code> column can be used538       to monitor the progress of the scan.539     </td></tr><tr><td><code class="literal">vacuuming indexes</code></td><td>540       <code class="command">VACUUM</code> is currently vacuuming the indexes.  If a table has541       any indexes, this will happen at least once per vacuum, after the heap542       has been completely scanned.  It may happen multiple times per vacuum543       if <a class="xref" href="runtime-config-resource.html#GUC-MAINTENANCE-WORK-MEM">maintenance_work_mem</a> (or, in the case of autovacuum,544       <a class="xref" href="runtime-config-resource.html#GUC-AUTOVACUUM-WORK-MEM">autovacuum_work_mem</a> if set) is insufficient to store545       the number of dead tuples found.546     </td></tr><tr><td><code class="literal">vacuuming heap</code></td><td>547       <code class="command">VACUUM</code> is currently vacuuming the heap.  Vacuuming the heap548       is distinct from scanning the heap, and occurs after each instance of549       vacuuming indexes.  If <code class="structfield">heap_blks_scanned</code> is less than550       <code class="structfield">heap_blks_total</code>, the system will return to scanning551       the heap after this phase is completed; otherwise, it will begin552       cleaning up indexes after this phase is completed.553     </td></tr><tr><td><code class="literal">cleaning up indexes</code></td><td>554       <code class="command">VACUUM</code> is currently cleaning up indexes.  This occurs after555       the heap has been completely scanned and all vacuuming of the indexes556       and the heap has been completed.557     </td></tr><tr><td><code class="literal">truncating heap</code></td><td>558       <code class="command">VACUUM</code> is currently truncating the heap so as to return559       empty pages at the end of the relation to the operating system.  This560       occurs after cleaning up indexes.561     </td></tr><tr><td><code class="literal">performing final cleanup</code></td><td>562       <code class="command">VACUUM</code> is performing final cleanup.  During this phase,563       <code class="command">VACUUM</code> will vacuum the free space map, update statistics564       in <code class="literal">pg_class</code>, and report statistics to the cumulative565       statistics system. When this phase is completed, <code class="command">VACUUM</code> will end.566     </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">28.4.6. Base Backup Progress Reporting <a href="#BASEBACKUP-PROGRESS-REPORTING" class="id_link">#</a></h3></div></div></div><a id="id-1.6.15.9.8.2" class="indexterm"></a><p>567   Whenever an application like <span class="application">pg_basebackup</span>568   is taking a base backup, the569   <code class="structname">pg_stat_progress_basebackup</code>570   view will contain a row for each WAL sender process that is currently571   running the <code class="command">BASE_BACKUP</code> replication command572   and streaming the backup. The tables below describe the information573   that will be reported and provide information about how to interpret it.574  </p><div class="table" id="PG-STAT-PROGRESS-BASEBACKUP-VIEW"><p class="title"><strong>Table 28.46. <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">575       Column Type576      </p>577      <p>578       Description579      </p></th></tr></thead><tbody><tr><td class="catalog_table_entry"><p class="column_definition">580       <code class="structfield">pid</code> <code class="type">integer</code>581      </p>582      <p>583       Process ID of a WAL sender process.584      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">585       <code class="structfield">phase</code> <code class="type">text</code>586      </p>587      <p>588       Current processing phase. See <a class="xref" href="progress-reporting.html#BASEBACKUP-PHASES" title="Table 28.47. Base Backup Phases">Table 28.47</a>.589      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">590       <code class="structfield">backup_total</code> <code class="type">bigint</code>591      </p>592      <p>593       Total amount of data that will be streamed. This is estimated and594       reported as of the beginning of595       <code class="literal">streaming database files</code> phase. Note that596       this is only an approximation since the database597       may change during <code class="literal">streaming database files</code> phase598       and WAL log may be included in the backup later. This is always599       the same value as <code class="structfield">backup_streamed</code>600       once the amount of data streamed exceeds the estimated601       total size. If the estimation is disabled in602       <span class="application">pg_basebackup</span>603       (i.e., <code class="literal">--no-estimate-size</code> option is specified),604       this is <code class="literal">NULL</code>.605      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">606       <code class="structfield">backup_streamed</code> <code class="type">bigint</code>607      </p>608      <p>609       Amount of data streamed. This counter only advances610       when the phase is <code class="literal">streaming database files</code> or611       <code class="literal">transferring wal files</code>.612      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">613       <code class="structfield">tablespaces_total</code> <code class="type">bigint</code>614      </p>615      <p>616       Total number of tablespaces that will be streamed.617      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">618       <code class="structfield">tablespaces_streamed</code> <code class="type">bigint</code>619      </p>620      <p>621       Number of tablespaces streamed. This counter only622       advances when the phase is <code class="literal">streaming database files</code>.623      </p></td></tr></tbody></table></div></div><br class="table-break" /><div class="table" id="BASEBACKUP-PHASES"><p class="title"><strong>Table 28.47. 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>624       The WAL sender process is preparing to begin the backup.625       This phase is expected to be very brief.626      </td></tr><tr><td><code class="literal">waiting for checkpoint to finish</code></td><td>627       The WAL sender process is currently performing628       <code class="function">pg_backup_start</code> to prepare to629       take a base backup, and waiting for the start-of-backup630       checkpoint to finish.631      </td></tr><tr><td><code class="literal">estimating backup size</code></td><td>632       The WAL sender process is currently estimating the total amount633       of database files that will be streamed as a base backup.634      </td></tr><tr><td><code class="literal">streaming database files</code></td><td>635       The WAL sender process is currently streaming database files636       as a base backup.637      </td></tr><tr><td><code class="literal">waiting for wal archiving to finish</code></td><td>638       The WAL sender process is currently performing639       <code class="function">pg_backup_stop</code> to finish the backup,640       and waiting for all the WAL files required for the base backup641       to be successfully archived.642       If either <code class="literal">--wal-method=none</code> or643       <code class="literal">--wal-method=stream</code> is specified in644       <span class="application">pg_basebackup</span>, the backup will end645       when this phase is completed.646      </td></tr><tr><td><code class="literal">transferring wal files</code></td><td>647       The WAL sender process is currently transferring all WAL logs648       generated during the backup. This phase occurs after649       <code class="literal">waiting for wal archiving to finish</code> phase if650       <code class="literal">--wal-method=fetch</code> is specified in651       <span class="application">pg_basebackup</span>. The backup will end652       when this phase is completed.653      </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="28.3. Viewing Locks">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="dynamic-trace.html" title="28.5. Dynamic Tracing">Next</a></td></tr><tr><td width="40%" align="left" valign="top">28.3. Viewing Locks </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.5. Dynamic Tracing</td></tr></table></div></body></html>
codekingpro/portable-devtools · Team Ai