バージョンごとのドキュメント一覧

第25章 定常的なデータベース保守作業

目次

25.1. 定常的なバキューム作業
25.1.1. バキューム作業の基本
25.1.2. ディスク容量の復旧
25.1.3. プランナ用の統計情報の更新
25.1.4. 可視性マップの更新
25.1.5. トランザクションIDの周回エラーの防止
25.1.6. 自動バキュームデーモン
25.2. 定常的なインデックスの再作成
25.3. ログファイルの保守
<title>Routine Database Maintenance Tasks</title>

<productname>PostgreSQL</productname>, like any database software, requires that certain tasks be performed regularly to achieve optimum performance. The tasks discussed here are <emphasis>required</emphasis>, but they are repetitive in nature and can easily be automated using standard tools such as <application>cron</application> scripts or Windows' <application>Task Scheduler</application>. It is the database administrator's responsibility to set up appropriate scripts, and to check that they execute successfully. 他のデータベースソフトウェア同様、PostgreSQLも、最適な性能を得るために定常的に実施しなければならない作業があります。 ここで説明する作業は必要なものであり、その性質上繰り返し行うべきものです。 しかし、cronスクリプトなどの標準ツールや、Windowsのタスクスケジューラを使用して簡単に自動化することができます。 適切なスクリプトを設定し、その実行がうまく行くかどうかを点検することは、データベース管理者の責任です。

One obvious maintenance task is the creation of backup copies of the data on a regular schedule. Without a recent backup, you have no chance of recovery after a catastrophe (disk failure, fire, mistakenly dropping a critical table, etc.). The backup and recovery mechanisms available in <productname>PostgreSQL</productname> are discussed at length in <xref linkend="backup"/>. 明らかに必要な保守作業の1つに、定期的なデータのバックアップコピーの作成があります。 最近のバックアップがなければ、(ディスクの破損、火災、重要なテーブルの間違った削除などの)破滅の後、復旧することができません。 PostgreSQLで可能なバックアップとリカバリ機構については、第26章にて詳細に説明します。

The other main category of maintenance task is periodic <quote>vacuuming</quote> of the database. This activity is discussed in <xref linkend="routine-vacuuming"/>. Closely related to this is updating the statistics that will be used by the query planner, as discussed in <xref linkend="vacuum-for-statistics"/>. 他の保守作業の主なカテゴリには、定期的なデータベースのバキュームがあります。 この作業については25.1で説明します。 問い合わせプランナで使用される統計情報の更新も密接に関連しますが、こちらに関しては25.1.3で説明します。

Another task that might need periodic attention is log file management. This is discussed in <xref linkend="logfile-maintenance"/>. この他、定期的に行わなければならない作業にログファイルの管理があります。 これについては25.3で説明します。

<ulink url="https://bucardo.org/check_postgres/"><application>check_postgres</application></ulink> is available for monitoring database health and reporting unusual conditions. <application>check_postgres</application> integrates with Nagios and MRTG, but can be run standalone too. check_postgresが、データベースの健全性を監視し、異常な状態を報告するために用意されています。 check_postgresはNagiosおよびMRTGに組み込まれたものですが、独立して実行させることができます。

<productname>PostgreSQL</productname> is low-maintenance compared to some other database management systems. Nonetheless, appropriate attention to these tasks will go far towards ensuring a pleasant and productive experience with the system. PostgreSQLは他のデータベース管理システムに比べ、保守作業は少ないと言えます。 それでもなお、これらの作業に適切に注意することは、システムに対する快適かつ充実した経験を確実に得るのに効果があります。