[Feature Request] - VACUUM
andresribeiro opened this issue · comments
Commands such as
postgres:vacuum database
and
postgres:vacuum-schedule
would be good features
What would these commands do exactly?
Hey @josegonzalez! Thanks for taking a time to look at this feature request. As described here in the official PostgreSQL documentation:
VACUUM reclaims storage occupied by dead tuples. In normal PostgreSQL operation, tuples that are deleted or obsoleted by an update are not physically removed from their table; they remain present until a VACUUM is done. Therefore it's necessary to do VACUUM periodically, especially on frequently-updated tables.
The idea is that some command like postgres:vacuum
performs this operation on the database, while postgres:vacuum-schedule
does it periodically. Since the documentation recommends that VACUUM be run frequently, this last command will make it much easier
VACUUM is normally run by pg automatically, see autovacuum https://www.postgresql.org/docs/13/routine-vacuuming.html#AUTOVACUUM
PostgreSQL has an optional but highly recommended feature called autovacuum, whose purpose is to automate the execution of VACUUM and ANALYZE commands. When enabled, autovacuum checks for tables that have had a large number of inserted, updated or deleted tuples. These checks use the statistics collection facility; therefore, autovacuum cannot be used unless track_counts is set to true. In the default configuration, autovacuuming is enabled and the related configuration parameters are appropriately set.
Seems optional, but did this change in postgres 14?
@josegonzalez I don't think it has changed
Auto vacuum is enabled by default afaik for years.
Yeah I just looked it up and it seems so. Closing this as it's an unnecessary abstraction.