-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp-vacuumdb.html
More file actions
481 lines (481 loc) · 41.7 KB
/
app-vacuumdb.html
File metadata and controls
481 lines (481 loc) · 41.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!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>vacuumdb</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="app-reindexdb.html" title="reindexdb" /><link rel="next" href="reference-server.html" title="PostgreSQLサーバアプリケーション" /><meta name="viewport" content="width=device-width,initial-scale=1.0" /></head><body id="docContent" class="container-fluid col-10"><div class="other_version"><a href="https://www.postgresql.jp/document/">バージョンごとのドキュメント一覧</a></div><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="4" align="center"><a accesskey="h" href="index.html">PostgreSQL 18.3文書</a></th></tr><tr><td width="10%" align="left"></td><td width="10%" align="left"></td><td width="60%" align="center"><a href="reference-client.html" title="PostgreSQLクライアントアプリケーション">PostgreSQLクライアントアプリケーション</a></td><td width="20%" align="right"><div class="actions"><a class="issue" title="github" href="https://github.com/pgsql-jp/jpug-doc/issues/new?template=bug_report.yml&what-happened=version 18.3 : app-vacuumdb.html">誤訳等の報告
</a></div></td></tr><tr><td width="10%" align="left"><a accesskey="p" href="app-reindexdb.html" title="reindexdb">前へ</a> </td><td width="10%" align="left"><a accesskey="u" href="reference-client.html" title="PostgreSQLクライアントアプリケーション">上へ</a></td><td width="60%" align="center"><span class="application">vacuumdb</span></td><td width="20%" align="right"> <a accesskey="n" href="reference-server.html" title="PostgreSQLサーバアプリケーション">次へ</a></td></tr></table><hr /></div><div class="refentry" id="APP-VACUUMDB"><div class="titlepage"></div><a id="id-1.9.4.23.1" class="indexterm"></a><div class="refnamediv"><h2><span class="refentrytitle"><span class="application">vacuumdb</span></span></h2><p>vacuumdb<span class="original">
<refpurpose>garbage-collect and analyze a <productname>PostgreSQL</productname> database</refpurpose>
</span> — <span class="productname">PostgreSQL</span>データベースの不要領域の回収と解析を行う</p></div><div class="refsynopsisdiv"><h2>概要</h2><div class="cmdsynopsis"><p id="id-1.9.4.23.4.1"><code class="command">vacuumdb</code> [<em class="replaceable"><code>connection-option</code></em>...] [<em class="replaceable"><code>option</code></em>...]
[
<code class="option">-t</code> | <code class="option">--table</code>
<em class="replaceable"><code>table</code></em>
[( <em class="replaceable"><code>column</code></em> [,...] )]
]
... [
<em class="replaceable"><code>dbname</code></em> | <code class="option">-a</code> | <code class="option">--all</code>
]</p></div><div class="cmdsynopsis"><p id="id-1.9.4.23.4.2"><code class="command">vacuumdb</code> [<em class="replaceable"><code>connection-option</code></em>...] [<em class="replaceable"><code>option</code></em>...]
[
<code class="option">-n</code> | <code class="option">--schema</code>
<em class="replaceable"><code>schema</code></em>
]
... [
<em class="replaceable"><code>dbname</code></em> | <code class="option">-a</code> | <code class="option">--all</code>
]</p></div><div class="cmdsynopsis"><p id="id-1.9.4.23.4.3"><code class="command">vacuumdb</code> [<em class="replaceable"><code>connection-option</code></em>...] [<em class="replaceable"><code>option</code></em>...]
[
<code class="option">-N</code> | <code class="option">--exclude-schema</code>
<em class="replaceable"><code>schema</code></em>
]
... [
<em class="replaceable"><code>dbname</code></em> | <code class="option">-a</code> | <code class="option">--all</code>
]</p></div></div><div class="refsect1" id="id-1.9.4.23.5"><h2>説明</h2><span class="original">
<title>Description</title>
</span><p>
<span class="original">
<application>vacuumdb</application> is a utility for cleaning a
<productname>PostgreSQL</productname> database.
<application>vacuumdb</application> will also generate internal statistics
used by the <productname>PostgreSQL</productname> query optimizer.
</span>
<span class="application">vacuumdb</span>は、<span class="productname">PostgreSQL</span>データベースの不要領域のクリーンアップを行うユーティリティです。
また、<span class="application">vacuumdb</span>は<span class="productname">PostgreSQL</span>の問い合わせオプティマイザが使用する内部的な統計情報も生成します。
</p><p>
<span class="original">
<application>vacuumdb</application> is a wrapper around the SQL
command <link linkend="sql-vacuum"><command>VACUUM</command></link>.
There is no effective difference between vacuuming and analyzing
databases via this utility and via other methods for accessing the
server.
</span>
<span class="application">vacuumdb</span>は、SQLコマンド<a class="link" href="sql-vacuum.html" title="VACUUM"><code class="command">VACUUM</code></a>のラッパーです。
このユーティリティを使っても、これ以外の方法でサーバにアクセスしてバキュームや解析を行っても特に違いは生じません。
</p></div><div class="refsect1" id="id-1.9.4.23.6"><h2>オプション</h2><span class="original">
<title>Options</title>
</span><p>
<span class="original">
<application>vacuumdb</application> accepts the following command-line arguments:
</span>
<span class="application">vacuumdb</span>では、下記のコマンドライン引数を指定できます。
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="option">-a</code><br /></span><span class="term"><code class="option">--all</code></span></dt><dd><p>
<span class="original">
Vacuum all databases.
</span>
全てのデータベースに対してバキュームを行います。
</p></dd><dt><span class="term"><code class="option">--buffer-usage-limit <em class="replaceable"><code>size</code></em></code></span></dt><dd><p>
<span class="original">
Specifies the
<glossterm linkend="glossary-buffer-access-strategy">Buffer Access Strategy</glossterm>
ring buffer size for a given invocation of <application>vacuumdb</application>.
This size is used to calculate the number of shared buffers which will
be reused as part of this strategy. See <xref linkend="sql-vacuum"/>.
</span>
<span class="application">vacuumdb</span>の指定された呼び出しに対して<a class="glossterm" href="glossary.html#GLOSSARY-BUFFER-ACCESS-STRATEGY"><em class="glossterm"><a class="glossterm" href="glossary.html#GLOSSARY-BUFFER-ACCESS-STRATEGY" title="Buffer Access Strategy【バッファアクセスストラテジ】">バッファアクセスストラテジ</a></em></a>リングバッファサイズを指定します。
このサイズは、このストラテジのパートとして再利用される共有バッファの数を計算するために使用されます。
<a class="xref" href="sql-vacuum.html" title="VACUUM"><span class="refentrytitle">VACUUM</span></a>を参照してください。
</p></dd><dt><span class="term"><code class="option">[<span class="optional">-d</span>] <em class="replaceable"><code>dbname</code></em></code><br /></span><span class="term"><code class="option">[<span class="optional">--dbname=</span>]<em class="replaceable"><code>dbname</code></em></code></span></dt><dd><p>
<span class="original">
Specifies the name of the database to be cleaned or analyzed,
when <option>-a</option>/<option>&#45;-all</option> is not used.
If this is not specified, the database name is read
from the environment variable <envar>PGDATABASE</envar>. If
that is not set, the user name specified for the connection is
used. The <replaceable>dbname</replaceable> can be a <link
linkend="libpq-connstring">connection string</link>. If so,
connection string parameters will override any conflicting command
line options.
</span>
<code class="option">-a</code>(または<code class="option">--all</code>)も指定されていない場合、不要領域のクリーンアップ、または、解析を行うデータベース名を指定します。
データベース名が指定されていない場合は、データベース名は環境変数<code class="envar">PGDATABASE</code>から読み取られます。
この変数も設定されていない場合は、接続時に指定したユーザ名が使用されます。
<em class="replaceable"><code>dbname</code></em>は<a class="link" href="libpq-connect.html#LIBPQ-CONNSTRING" title="32.1.1. 接続文字列">接続文字列</a>に出来ます。その場合、接続文字列パラメータは競合するコマンドラインオプションを上書きします。
</p></dd><dt><span class="term"><code class="option">--disable-page-skipping</code></span></dt><dd><p>
<span class="original">
Disable skipping pages based on the contents of the visibility map.
</span>
可視性マップの内容に基づいてページを飛ばすことのないようにします。
</p></dd><dt><span class="term"><code class="option">-e</code><br /></span><span class="term"><code class="option">--echo</code></span></dt><dd><p>
<span class="original">
Echo the commands that <application>vacuumdb</application> generates
and sends to the server.
</span>
<span class="application">vacuumdb</span>が生成し、サーバに送るコマンドをエコー表示します。
</p></dd><dt><span class="term"><code class="option">-f</code><br /></span><span class="term"><code class="option">--full</code></span></dt><dd><p>
<span class="original">
Perform <quote>full</quote> vacuuming.
</span>
<span class="quote">「<span class="quote">完全な(full)</span>」</span>クリーンアップを行います。
</p></dd><dt><span class="term"><code class="option">-F</code><br /></span><span class="term"><code class="option">--freeze</code></span></dt><dd><p>
<span class="original">
Aggressively <quote>freeze</quote> tuples.
</span>
積極的にタプルを<span class="quote">「<span class="quote">凍結</span>」</span>します。
</p></dd><dt><span class="term"><code class="option">--force-index-cleanup</code></span></dt><dd><p>
<span class="original">
Always remove index entries pointing to dead tuples.
</span>
無効なタプルを指しているインデックスエントリを常に削除します。
</p></dd><dt><span class="term"><code class="option">-j <em class="replaceable"><code>njobs</code></em></code><br /></span><span class="term"><code class="option">--jobs=<em class="replaceable"><code>njobs</code></em></code></span></dt><dd><p>
<span class="original">
Execute the vacuum or analyze commands in parallel by running
<replaceable class="parameter">njobs</replaceable>
commands simultaneously. This option may reduce the processing time
but it also increases the load on the database server.
</span>
<em class="replaceable"><code>njobs</code></em>個のコマンドを同時に実行することで、vacuumまたはanalyzeコマンドを並列で実行します。このオプションは処理時間を短縮することもありますがデータベースサーバの負荷も増加します。
</p><p>
<span class="original">
<application>vacuumdb</application> will open
<replaceable class="parameter">njobs</replaceable> connections to the
database, so make sure your <xref linkend="guc-max-connections"/>
setting is high enough to accommodate all connections.
</span>
<span class="application">vacuumdb</span>はデータベースに対する<em class="replaceable"><code>njobs</code></em>個の接続を開くので、<a class="xref" href="runtime-config-connection.html#GUC-MAX-CONNECTIONS">max_connections</a>の設定が、これらの接続を許容するだけ十分に大きくしてください。
</p><p>
<span class="original">
Note that using this mode together with the <option>-f</option>
(<literal>FULL</literal>) option might cause deadlock failures if
certain system catalogs are processed in parallel.
</span>
このモードを<code class="option">-f</code>(<code class="literal">FULL</code>)オプションと一緒に使うと、一部のシステムカタログが並列処理されてデッドロックのエラーを起こす場合があることに注意してください。
</p></dd><dt><span class="term"><code class="option">--min-mxid-age <em class="replaceable"><code>mxid_age</code></em></code></span></dt><dd><p>
<span class="original">
Only execute the vacuum or analyze commands on tables with a multixact
ID age of at least <replaceable class="parameter">mxid_age</replaceable>.
This setting is useful for prioritizing tables to process to prevent
multixact ID wraparound (see
<xref linkend="vacuum-for-multixact-wraparound"/>).
</span>
マルチトランザクションIDの年代が少なくとも<em class="replaceable"><code>mxid_age</code></em>であるテーブルに対してのみ、バキュームもしくは解析コマンドを実行します。
この設定は、マルチトランザクションIDの周回を防ぐためテーブルに優先順位を付けて処理するのに有用です(<a class="xref" href="routine-vacuuming.html#VACUUM-FOR-MULTIXACT-WRAPAROUND" title="24.1.5.1. マルチトランザクションと周回">24.1.5.1</a>を参照してください)。
</p><p>
<span class="original">
For the purposes of this option, the multixact ID age of a relation is
the greatest of the ages of the main relation and its associated
<acronym>TOAST</acronym> table, if one exists. Since the commands
issued by <application>vacuumdb</application> will also process the
<acronym>TOAST</acronym> table for the relation if necessary, it does
not need to be considered separately.
</span>
このオプションの目的のため、リレーションのマルチトランザクションIDの年代は、主であるリレーションの年代と、存在するなら、関連する<acronym class="acronym">TOAST</acronym>テーブルの年代のうち最大のものです。
<span class="application">vacuumdb</span>により発行されたコマンドも、必要であればリレーションの<acronym class="acronym">TOAST</acronym>テーブルを処理しますので、別々に分けて考える必要はないです。
</p></dd><dt><span class="term"><code class="option">--min-xid-age <em class="replaceable"><code>xid_age</code></em></code></span></dt><dd><p>
<span class="original">
Only execute the vacuum or analyze commands on tables with a
transaction ID age of at least
<replaceable class="parameter">xid_age</replaceable>. This setting
is useful for prioritizing tables to process to prevent transaction
ID wraparound (see <xref linkend="vacuum-for-wraparound"/>).
</span>
トランザクションIDの年代が少なくとも<em class="replaceable"><code>xid_age</code></em>であるテーブルに対してのみ、バキュームもしくは解析コマンドを実行します。
この設定は、トランザクションIDの周回を防ぐためテーブルに優先順位を付けて処理するのに有用です(<a class="xref" href="routine-vacuuming.html#VACUUM-FOR-WRAPAROUND" title="24.1.5. トランザクションIDの周回エラーの防止">24.1.5</a>を参照してください)。
</p><p>
<span class="original">
For the purposes of this option, the transaction ID age of a relation
is the greatest of the ages of the main relation and its associated
<acronym>TOAST</acronym> table, if one exists. Since the commands
issued by <application>vacuumdb</application> will also process the
<acronym>TOAST</acronym> table for the relation if necessary, it does
not need to be considered separately.
</span>
このオプションの目的のため、リレーションのトランザクションIDの年代は、主であるリレーションの年代と、存在するなら、関連する<acronym class="acronym">TOAST</acronym>テーブルの年代のうち最大のものです。
<span class="application">vacuumdb</span>により発行されたコマンドも、必要であればリレーションの<acronym class="acronym">TOAST</acronym>テーブルを処理しますので、別々に分けて考える必要はないです。
</p></dd><dt><span class="term"><code class="option">--missing-stats-only</code></span></dt><dd><p>
<span class="original">
Only analyze relations that are missing statistics for a column, index
expression, or extended statistics object. When used with
<option>&#45;-analyze-in-stages</option>, this option prevents
<application>vacuumdb</application> from temporarily replacing existing
statistics with ones generated with lower statistics targets, thus
avoiding transiently worse query optimizer choices.
</span>
列、インデックス式または拡張統計オブジェクトの統計情報がないリレーションだけを解析します。
<code class="option">--analyze-in-stages</code>とともに使用すると、このオプションは<span class="application">vacuumdb</span>が既存の統計情報をより低い統計情報目標で生成されたもので一時的に置換するのを防ぎ、問い合わせオプティマイザが一時的により不適切な選択をするのを回避できます。
</p><p>
<span class="original">
This option can only be used in conjunction with
<option>&#45;-analyze-only</option> or <option>&#45;-analyze-in-stages</option>.
</span>
このオプションは、<code class="option">--analyze-only</code>または<code class="option">--analyze-in-stages</code>と組み合わせてのみ使用できます。
</p><p>
<span class="original">
Note that <option>&#45;-missing-stats-only</option> requires
<literal>SELECT</literal> privileges on
<link linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>
and
<link linkend="catalog-pg-statistic-ext-data"><structname>pg_statistic_ext_data</structname></link>,
which are restricted to superusers by default.
</span>
<code class="option">--missing-stats-only</code>は<a class="link" href="catalog-pg-statistic.html" title="52.51. pg_statistic"><code class="structname">pg_statistic</code></a>と<a class="link" href="catalog-pg-statistic-ext-data.html" title="52.53. pg_statistic_ext_data"><code class="structname">pg_statistic_ext_data</code></a>の<code class="literal">SELECT</code>権限を必要とし、これらはデフォルトでスーパーユーザに制限されていることに注意してください。
</p></dd><dt><span class="term"><code class="option">-n <em class="replaceable"><code>schema</code></em></code><br /></span><span class="term"><code class="option">--schema=<em class="replaceable"><code>schema</code></em></code></span></dt><dd><p>
<span class="original">
Clean or analyze all tables in
<replaceable class="parameter">schema</replaceable> only. Multiple
schemas can be vacuumed by writing multiple <option>-n</option> switches.
</span>
<em class="replaceable"><code>schema</code></em>内のすべてのテーブルのみをクリーンアップまたは解析します。
<code class="option">-n</code>スイッチを複数記述することで複数のスキーマをバキュームできます。
</p></dd><dt><span class="term"><code class="option">-N <em class="replaceable"><code>schema</code></em></code><br /></span><span class="term"><code class="option">--exclude-schema=<em class="replaceable"><code>schema</code></em></code></span></dt><dd><p>
<span class="original">
Do not clean or analyze any tables in
<replaceable class="parameter">schema</replaceable>. Multiple schemas
can be excluded by writing multiple <option>-N</option> switches.
</span>
<em class="replaceable"><code>schema</code></em>内のテーブルをクリーンアップまたは解析しません。
<code class="option">-N</code>スイッチを複数記述することで複数のスキーマを除外できます。
</p></dd><dt><span class="term"><code class="option">--no-index-cleanup</code></span></dt><dd><p>
<span class="original">
Do not remove index entries pointing to dead tuples.
</span>
無効なタプルを指しているインデックスエントリを削除しません。
</p></dd><dt><span class="term"><code class="option">--no-process-main</code></span></dt><dd><p>
<span class="original">
Skip the main relation.
</span>
主リレーションをスキップします。
</p></dd><dt><span class="term"><code class="option">--no-process-toast</code></span></dt><dd><p>
<span class="original">
Skip the TOAST table associated with the table to vacuum, if any.
</span>
もし存在するなら、バキュームするテーブルに関連するTOASTテーブルをスキップします。
</p></dd><dt><span class="term"><code class="option">--no-truncate</code></span></dt><dd><p>
<span class="original">
Do not truncate empty pages at the end of the table.
</span>
テーブルの終わりにある空のページを切り詰めません。
</p></dd><dt><span class="term"><code class="option">-P <em class="replaceable"><code>parallel_workers</code></em></code><br /></span><span class="term"><code class="option">--parallel=<em class="replaceable"><code>parallel_workers</code></em></code></span></dt><dd><p>
<span class="original">
Specify the number of parallel workers for <firstterm>parallel vacuum</firstterm>.
This allows the vacuum to leverage multiple CPUs to process indexes.
See <xref linkend="sql-vacuum"/>.
</span>
<em class="firstterm">並列バキューム</em>のためのパラレルワーカーの数を指定します。
これによりバキュームが複数CPUを活用してインデックスを処理できます。
<a class="xref" href="sql-vacuum.html" title="VACUUM"><span class="refentrytitle">VACUUM</span></a>を参照してください。
</p></dd><dt><span class="term"><code class="option">-q</code><br /></span><span class="term"><code class="option">--quiet</code></span></dt><dd><p>
<span class="original">
Do not display progress messages.
</span>
進行メッセージを表示しません。
</p></dd><dt><span class="term"><code class="option">--skip-locked</code></span></dt><dd><p>
<span class="original">
Skip relations that cannot be immediately locked for processing.
</span>
処理のためにすぐにロックできないリレーションをスキップします。
</p></dd><dt><span class="term"><code class="option">-t <em class="replaceable"><code>table</code></em> [ (<em class="replaceable"><code>column</code></em> [,...]) ]</code><br /></span><span class="term"><code class="option">--table=<em class="replaceable"><code>table</code></em> [ (<em class="replaceable"><code>column</code></em> [,...]) ]</code></span></dt><dd><p>
<span class="original">
Clean or analyze <replaceable class="parameter">table</replaceable> only.
Column names can be specified only in conjunction with
the <option>&#45;-analyze</option> or <option>&#45;-analyze-only</option> options.
Multiple tables can be vacuumed by writing multiple
<option>-t</option> switches.
</span>
<em class="replaceable"><code>table</code></em>のみをクリーンアップ/解析します。
列名は<code class="option">--analyze</code>や<code class="option">--analyze-only</code>オプションがある場合にのみ設定できます。
複数の<code class="option">-t</code>スイッチを記述することで複数のテーブルをバキュームすることができます。
</p><div class="tip"><h3 class="title">ヒント</h3><p>
<span class="original">
If you specify columns, you probably have to escape the parentheses
from the shell. (See examples below.)
</span>
列を指定する場合は、シェルから括弧をエスケープする必要があるでしょう。
(後述の例を参照してください。)
</p></div></dd><dt><span class="term"><code class="option">-v</code><br /></span><span class="term"><code class="option">--verbose</code></span></dt><dd><p>
<span class="original">
Print detailed information during processing.
</span>
処理中に詳細な情報を表示します。
</p></dd><dt><span class="term"><code class="option">-V</code><br /></span><span class="term"><code class="option">--version</code></span></dt><dd><p>
<span class="original">
Print the <application>vacuumdb</application> version and exit.
</span>
<span class="application">vacuumdb</span>のバージョンを表示し、終了します。
</p></dd><dt><span class="term"><code class="option">-z</code><br /></span><span class="term"><code class="option">--analyze</code></span></dt><dd><p>
<span class="original">
Also calculate statistics for use by the optimizer.
</span>
オプティマイザが使用する、データベースの統計情報も算出します。
</p></dd><dt><span class="term"><code class="option">-Z</code><br /></span><span class="term"><code class="option">--analyze-only</code></span></dt><dd><p>
<span class="original">
Only calculate statistics for use by the optimizer (no vacuum).
</span>
オプティマイザにより使用される統計情報の計算のみを行います(バキュームを行いません)。
</p></dd><dt><span class="term"><code class="option">--analyze-in-stages</code></span></dt><dd><p>
<span class="original">
Only calculate statistics for use by the optimizer (no vacuum),
like <option>&#45;-analyze-only</option>. Run three
stages of analyze; the first stage uses the lowest possible statistics
target (see <xref linkend="guc-default-statistics-target"/>)
to produce usable statistics faster, and subsequent stages build the
full statistics.
</span>
<code class="option">--analyze-only</code>と同様、オプティマイザにより使用される統計情報の計算のみを行います(バキュームを行いません)。
分析の3つの段階を実行します。
最初の段階では、使用可能な統計情報をより迅速に生成するために最小の統計情報目標(<a class="xref" href="runtime-config-query.html#GUC-DEFAULT-STATISTICS-TARGET">default_statistics_target</a>を参照)を使い、後続のステージでは完全な統計情報を構築します。
</p><p>
<span class="original">
This option is only useful to analyze a database that currently has
no statistics or has wholly incorrect ones, such as if it is newly
populated from a restored dump or by <command>pg_upgrade</command>.
Be aware that running with this option in a database with existing
statistics may cause the query optimizer choices to become
transiently worse due to the low statistics targets of the early
stages.
</span>
このオプションは、統計情報を現在持たないデータベースや、完全に誤った統計情報を持つデータベースを解析する場合にのみ有用です。
例えば、リストアされたダンプや<code class="command">pg_upgrade</code>によって新たにデータが生成された場合などです。
統計情報が既にあるデータベースに対してこのオプションで実行すると、初期段階の統計情報目標が低いため、問い合わせオプティマイザの選択が一時的に悪化する可能性があることに注意してください。
</p></dd><dt><span class="term"><code class="option">-?</code><br /></span><span class="term"><code class="option">--help</code></span></dt><dd><p>
<span class="original">
Show help about <application>vacuumdb</application> command line
arguments, and exit.
</span>
<span class="application">vacuumdb</span>のコマンドライン引数の使用方法を表示し、終了します。
</p></dd></dl></div><p>
</p><p>
<span class="original">
<application>vacuumdb</application> also accepts
the following command-line arguments for connection parameters:
</span>
<span class="application">vacuumdb</span>には、以下に記す接続パラメータ用のコマンドライン引数も指定することもできます。
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="option">-h <em class="replaceable"><code>host</code></em></code><br /></span><span class="term"><code class="option">--host=<em class="replaceable"><code>host</code></em></code></span></dt><dd><p>
<span class="original">
Specifies the host name of the machine on which the server
is running. If the value begins with a slash, it is used
as the directory for the Unix domain socket.
</span>
サーバが稼働しているマシンのホスト名を指定します。
ホスト名がスラッシュから始まる場合、Unixドメインソケット用のディレクトリとして使用されます。
</p></dd><dt><span class="term"><code class="option">-p <em class="replaceable"><code>port</code></em></code><br /></span><span class="term"><code class="option">--port=<em class="replaceable"><code>port</code></em></code></span></dt><dd><p>
<span class="original">
Specifies the TCP port or local Unix domain socket file
extension on which the server
is listening for connections.
</span>
サーバが接続を監視するTCPポートもしくはUnixドメインソケットファイルの拡張子を指定します。
</p></dd><dt><span class="term"><code class="option">-U <em class="replaceable"><code>username</code></em></code><br /></span><span class="term"><code class="option">--username=<em class="replaceable"><code>username</code></em></code></span></dt><dd><p>
<span class="original">
User name to connect as.
</span>
接続するユーザ名を指定します。
</p></dd><dt><span class="term"><code class="option">-w</code><br /></span><span class="term"><code class="option">--no-password</code></span></dt><dd><p>
<span class="original">
Never issue a password prompt. If the server requires
password authentication and a password is not available by
other means such as a <filename>.pgpass</filename> file, the
connection attempt will fail. This option can be useful in
batch jobs and scripts where no user is present to enter a
password.
</span>
パスワードの入力を促しません。
サーバがパスワード認証を必要とし、かつ、<code class="filename">.pgpass</code>ファイルなどの他の方法が利用できない場合、接続試行は失敗します。
バッチジョブやスクリプトなどパスワードを入力するユーザが存在しない場合にこのオプションは有用かもしれません。
</p></dd><dt><span class="term"><code class="option">-W</code><br /></span><span class="term"><code class="option">--password</code></span></dt><dd><p>
<span class="original">
Force <application>vacuumdb</application> to prompt for a
password before connecting to a database.
</span>
データベースに接続する前に、<span class="application">vacuumdb</span>は強制的にパスワード入力を促します。
</p><p>
<span class="original">
This option is never essential, since
<application>vacuumdb</application> will automatically prompt
for a password if the server demands password authentication.
However, <application>vacuumdb</application> will waste a
connection attempt finding out that the server wants a password.
In some cases it is worth typing <option>-W</option> to avoid the extra
connection attempt.
</span>
サーバがパスワード認証を要求する場合<span class="application">vacuumdb</span>は自動的にパスワード入力を促しますので、これが重要になることはありません。
しかし、<span class="application">vacuumdb</span>は、サーバにパスワードが必要かどうかを判断するための接続試行を無駄に行います。
こうした余計な接続試行を防ぐために<code class="option">-W</code>の入力が有意となる場合もあります。
</p></dd><dt><span class="term"><code class="option">--maintenance-db=<em class="replaceable"><code>dbname</code></em></code></span></dt><dd><p>
<span class="original">
When the <option>-a</option>/<option>&#45;-all</option> is used, connect
to this database to gather the list of databases to vacuum.
If not specified, the <literal>postgres</literal> database will be used,
or if that does not exist, <literal>template1</literal> will be used.
This can be a <link linkend="libpq-connstring">connection
string</link>. If so, connection string parameters will override any
conflicting command line options. Also, connection string parameters
other than the database name itself will be re-used when connecting
to other databases.
</span>
<code class="option">-a</code>/<code class="option">--all</code>が使われている場合に、バキュームするデータベースの一覧を集めるため、このデータベースに接続します。
データベース名が指定されていなければ<code class="literal">postgres</code>データベースが使用され、もし存在しなければ<code class="literal">template1</code>が使用されます。
これは<a class="link" href="libpq-connect.html#LIBPQ-CONNSTRING" title="32.1.1. 接続文字列">接続文字列</a>に出来ます。
その場合、接続文字列パラメータは競合するコマンドラインオプションを上書きします。
また、データベース名以外の接続文字列パラメータは他のデータベースに接続する時に再利用されます。
</p></dd></dl></div><p>
</p></div><div class="refsect1" id="id-1.9.4.23.7"><h2>環境</h2><span class="original">
<title>Environment</title>
</span><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="envar">PGDATABASE</code><br /></span><span class="term"><code class="envar">PGHOST</code><br /></span><span class="term"><code class="envar">PGPORT</code><br /></span><span class="term"><code class="envar">PGUSER</code></span></dt><dd><p>
<span class="original">
Default connection parameters
</span>
デフォルトの接続パラメータです。
</p></dd><dt><span class="term"><code class="envar">PG_COLOR</code></span></dt><dd><p>
<span class="original">
Specifies whether to use color in diagnostic messages. Possible values
are <literal>always</literal>, <literal>auto</literal> and
<literal>never</literal>.
</span>
診断メッセージで色を使うかどうかを指定します。
指定可能な値は<code class="literal">always</code>、<code class="literal">auto</code>、<code class="literal">never</code>です。
</p></dd></dl></div><p>
<span class="original">
This utility, like most other <productname>PostgreSQL</productname> utilities,
also uses the environment variables supported by <application>libpq</application>
(see <xref linkend="libpq-envars"/>).
</span>
このユーティリティは、他のほとんどの<span class="productname">PostgreSQL</span>ユーティリティと同様、<span class="application">libpq</span>がサポートする環境変数(<a class="xref" href="libpq-envars.html" title="32.15. 環境変数">32.15</a>参照)も使います。
</p></div><div class="refsect1" id="id-1.9.4.23.8"><h2>診断</h2><span class="original">
<title>Diagnostics</title>
</span><p>
<span class="original">
In case of difficulty, see <xref linkend="sql-vacuum"/>
and <xref linkend="app-psql"/> for
discussions of potential problems and error messages.
The database server must be running at the
targeted host. Also, any default connection settings and environment
variables used by the <application>libpq</application> front-end
library will apply.
</span>
問題が発生した場合、考えられる原因とエラーメッセージについての説明は<a class="xref" href="sql-vacuum.html" title="VACUUM"><span class="refentrytitle">VACUUM</span></a>と<a class="xref" href="app-psql.html" title="psql"><span class="refentrytitle"><span class="application">psql</span></span></a>を参照してください。
データベースサーバは、指定したホストで稼働している必要があります。
また、<span class="application">libpq</span>フロントエンドライブラリのデフォルトの設定や環境変数が適用されることに注意してください。
</p></div><div class="refsect1" id="id-1.9.4.23.9"><h2>例</h2><span class="original">
<title>Examples</title>
</span><p>
<span class="original">
To clean the database <literal>test</literal>:
</span>
<code class="literal">test</code>というデータベースをクリーンアップするには、下記のコマンドを実行します。
</p><pre class="screen">
<code class="prompt">$ </code><strong class="userinput"><code>vacuumdb test</code></strong>
</pre><p>
</p><p>
<span class="original">
To clean and analyze for the optimizer a database named
<literal>bigdb</literal>:
</span>
<code class="literal">bigdb</code>という名前のデータベースのクリーンアップとオプティマイザ用の解析を行う場合には、下記のコマンドを実行します。
</p><pre class="screen">
<code class="prompt">$ </code><strong class="userinput"><code>vacuumdb --analyze bigdb</code></strong>
</pre><p>
</p><p>
<span class="original">
To clean a single table
<literal>foo</literal> in a database named
<literal>xyzzy</literal>, and analyze a single column
<literal>bar</literal> of the table for the optimizer:
</span>
<code class="literal">xyzzy</code>という名前のデータベースの<code class="literal">foo</code>という1つのテーブルだけのクリーンアップと、そのテーブルの<code class="literal">bar</code>という1つの列にだけ対してオプティマイザ用の解析を行う場合には、下記のコマンドを実行します。
</p><pre class="screen">
<code class="prompt">$ </code><strong class="userinput"><code>vacuumdb --analyze --verbose --table='foo(bar)' xyzzy</code></strong>
</pre><p>
<span class="original">
To clean all tables in the <literal>foo</literal> and <literal>bar</literal> schemas
in a database named <literal>xyzzy</literal>:
</span>
<code class="literal">xyzzy</code>という名前のデータベースの<code class="literal">foo</code>スキーマと<code class="literal">bar</code>スキーマのすべてのテーブルをクリーンアップする場合には、下記のコマンドを実行します。
</p><pre class="screen">
<code class="prompt">$ </code><strong class="userinput"><code>vacuumdb --schema='foo' --schema='bar' xyzzy</code></strong>
</pre></div><div class="refsect1" id="id-1.9.4.23.10"><h2>関連項目</h2><span class="original">
<title>See Also</title>
</span><span class="simplelist"><a class="xref" href="sql-vacuum.html" title="VACUUM"><span class="refentrytitle">VACUUM</span></a></span></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="app-reindexdb.html" title="reindexdb">前へ</a> </td><td width="20%" align="center"><a accesskey="u" href="reference-client.html" title="PostgreSQLクライアントアプリケーション">上へ</a></td><td width="40%" align="right"> <a accesskey="n" href="reference-server.html" title="PostgreSQLサーバアプリケーション">次へ</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="application">reindexdb</span> </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 18.3文書">ホーム</a></td><td width="40%" align="right" valign="top"> PostgreSQLサーバアプリケーション</td></tr></table></div></body></html>