Postgres autovacuum


```typeSHOW autovacuum;```

```typeSELECT relname, n_live_tup, n_dead_tup, n_dead_tup / (n_live_tup::float) as ratioFROM pg_stat_user_tablesWHERE n_live_tup > 0 AND n_dead_tup > 1000ORDER BY ratio DESC;```


각 테이블 별로 Autovacuum 이 마지막에 실행된 시각
```typeSELECT relname, last_vacuum, last_autovacuum, last_analyze, last_autoanalyzeFROM pg_stat_user_tablesORDER BY relname asc;```


### tune table
```typeALTER TABLE spatial_ref_sys SET (autovacuum_vacuum_scale_factor = 0.0);ALTER TABLE spatial_ref_sys SET (autovacuum_vacuum_threshold = 100000);ALTER TABLE spatial_ref_sys SET (autovacuum_vacuum_cost_limit = 1000);```




> [PostgreSQL 튜닝 - Autovacuum 최적화에 대하여](https://nrise.github.io/posts/postgresql-autovacuum/)





