我在Ubuntu上運行PostgreSQL 9.2。 自動清理過程正在服務器上運行。儘管進程正在運行,但postgresql autovacuum不工作
數據庫每天都有很高的負載,1000次的增加和100次的刪除,但似乎autovacuum沒有啓動。
日誌中沒有與真空有關的東西。
做ps -ef | grep -i vacuum
生產:postgres 1406 1130 0 Oct13 00:00:14 postgres: autovacuum launcher process
運行查詢SELECT last_autovacuum , last_autoanalyze FROM pg_stat_user_tables;
產生於上自動清理列沒有任何記錄,和2個entrys在suto_analyze列。
postgresql.conf中的有關章節是:
#------------------------------------------------------------------------------
# AUTOVACUUM PARAMETERS
#------------------------------------------------------------------------------
autovacuum = on # Enable autovacuum subprocess? 'on'
# requires track_counts to also be on.
log_autovacuum_min_duration = 250 # -1 disables, 0 logs all actions and
# their durations, > 0 logs only
# actions running at least this number
# of milliseconds.
autovacuum_max_workers = 3 # max number of autovacuum subprocesses
# (change requires restart)
#autovacuum_naptime = 1min # time between autovacuum runs
autovacuum_vacuum_threshold = 128 # min number of row updates before
# vacuum
autovacuum_analyze_threshold = 128 # min number of row updates before
# analyze
#autovacuum_vacuum_scale_factor = 0.2 # fraction of table size before vacuum
#autovacuum_analyze_scale_factor = 0.1 # fraction of table size before analyze
#autovacuum_freeze_max_age = 200000000 # maximum XID age before forced vacuum
# (change requires restart)
#autovacuum_vacuum_cost_delay = 20ms # default vacuum cost delay for
# autovacuum, in milliseconds;
# -1 means use vacuum_cost_delay
#autovacuum_vacuum_cost_limit = -1 # default vacuum cost limit for
# autovacuum, -1 means use
# vacuum_cost_limit
有什麼想法?
見http://www.postgresql.org/docs/9.2/static/monitoring-stats.html last_autovacuum - 在此表被自動清理真空上次守護進程。我想這是完成autovaccuum的時間。無論如何,只要守護進程產生高負載就不可能運行。嘗試從命令行運行真空作爲SQL命令,以查看每個表上運行真空的時間。 –
「1000的增加和100的刪除」並不是那麼多的活動。你在桌子上膨脹嗎? n_dead_tup是否暗示抽真空實際上是由於任何表格?也許真空吸塵器對你而言並不經常需要。設置log_autovacuum_min_duration = 0應該讓更多的東西寫入日誌,儘管可能不足以向您證明它運行良好。什麼是suto_analyze? – jjanes