Postgresql 中文操作指南
Chapter 25. Routine Database Maintenance Tasks
Table of Contents
PostgreSQL 和任何数据库软件一样,需要定期执行某些任务来达到最佳的性能。这里讨论的任务是 required ,但是它们本质上是重复性的,并且可以使用 cron 脚本或 Windows' 任务计划器等标准工具轻松实现自动化。由数据库管理员负责设置合适的脚本、并检查它们是否成功执行。
PostgreSQL, like any database software, requires that certain tasks be performed regularly to achieve optimum performance. The tasks discussed here are required, but they are repetitive in nature and can easily be automated using standard tools such as cron scripts or Windows' Task Scheduler. It is the database administrator’s responsibility to set up appropriate scripts, and to check that they execute successfully.
一个显而易见的维护任务是在一个定期计划中创建数据的备份副本。如果没有最近的备份,在灾难(磁盘故障、火灾、错误地删除了一个关键表等)之后你就无法恢复数据了。PostgreSQL 中可用的备份和恢复机制在 Chapter 26 中详细讨论。
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 PostgreSQL are discussed at length in Chapter 26.
维护任务的另一主要类别是对数据库定期“vacuuming”。这项活动在 Section 25.1 中讨论。与之密切相关的是更新查询计划程序将使用的统计数据,如 Section 25.1.3 中所讨论。
The other main category of maintenance task is periodic “vacuuming” of the database. This activity is discussed in Section 25.1. Closely related to this is updating the statistics that will be used by the query planner, as discussed in Section 25.1.3.
另一项可能需要定期关注的任务是日志文件管理。这在 Section 25.3 中讨论。
Another task that might need periodic attention is log file management. This is discussed in Section 25.3.
check_postgres 可用于监视数据库运行状况和报告异常情况。check_postgres 集成了 Nagios 和 MRTG,但也可以独立运行。
check_postgres is available for monitoring database health and reporting unusual conditions. check_postgres integrates with Nagios and MRTG, but can be run standalone too.
与其他一些数据库管理系统相比,PostgreSQL 的维护量很低。尽管如此,适当关注这些任务将很大程度上确保使用该系统时获得愉快而富有成效的体验。
PostgreSQL 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.