自动真空不清除数据库。数据库中-db Postgres 10.18,AWS (vCPU 2,RAM 8Gb,SSD(gp2) 1100 gp2)
表"spree_datafeed_products“
relid | 16556
schemaname | public
relname | spree_datafeed_products
seq_scan | 20
seq_tup_read | 365522436
idx_scan | 962072108
idx_tup_fetch | 9929276855
n_tup_ins | 2846455
n_tup_upd | 35778058
n_tup_del | 284291955
n_tup_hot_upd | 0
n_live_tup | 3546840
n_dead_tup | 338790851
n_mod_since_analyze | 307930753
last_vacuum |
last_autovacuum |
last_analyze |
last_autoanalyze | 2022-04-29 13:01:43.985749+00
vacuum_count | 0
autovacuum_count | 0
analyze_count | 0
autoanalyze_count | 1表和索引大小:
indexname | size
index_spree_datafeed_products_on_updated_at | 48 GB
index_spree_datafeed_products_on_state | 35 GB
index_spree_datafeed_products_on_size_variant_field | 40 GB
index_spree_datafeed_products_on_product_id | 32 GB
index_spree_datafeed_products_on_original_id | 31 GB
index_spree_datafeed_products_on_datafeed_id | 42 GB
index_spree_datafeed_products_on_datafeed_id_and_original_id | 31 GB
index_spree_datafeed_products_on_data_hash | 39 GB
spree_datafeed_products_pkey | 18 GB
pg_size_pretty - 419 GB工人:
datid | 16404
datname | milanstyle_production
pid | 2274
backend_start | 2022-05-01 19:52:00.066097+00
xact_start | 2022-05-01 19:52:00.23692+00
query_start | 2022-05-01 19:52:00.23692+00
state_change | 2022-05-01 19:52:00.236921+00
wait_event_type |
wait_event |
state | active
backend_xid |
backend_xmin | 1301636863
query | autovacuum: VACUUM ANALYZE public.spree_datafeed_products
backend_type | autovacuum worker设置:
autovacuum on
autovacuum_analyze_scale_factor 0.05
autovacuum_analyze_threshold 50
autovacuum_freeze_max_age 200000000
autovacuum_max_workers 3
autovacuum_multixact_freeze_max_age 400000000
autovacuum_naptime 30
autovacuum_vacuum_cost_delay 20
autovacuum_vacuum_cost_limit -1
autovacuum_vacuum_scale_factor 0.1
autovacuum_vacuum_threshold 50垃圾清理脚本已经积累了大量已删除的条目。我们已经等了一个多星期(自动通关)。有什么问题吗?为什么数据库出现故障?
发布于 2022-05-10 14:06:59
需要很长时间才能将这样大小的表与这些设置(假设你没有显示的是默认设置)真空起来。
如果活的元组真的是死气沉沉的元组的1%,那么走出这个洞的最简单的方法可能是一个满是桌子的真空。
为了避免再次陷入这个漏洞,您至少应该将autovacuum_vacuum_cost_delay降到2,并将autovacuum_work_mem增加到至少256 do (但我可能会做1GB)。
我也会查看日志,看看自动车辆是否有在完成前被取消的历史。
https://dba.stackexchange.com/questions/311931
复制相似问题