Database Reference
In-Depth Information
Database tuning
Over time, it is very common that your database starts to generate some dead rows. This is
a side effect generated by the
Multiversion Concurrency Control
(
MVCC
) mechanism
of Postgres that tracks the changes in your database. The
UPDATE
and
DELETE
operations
also contribute to generate these lines.
For example, when you
DELETE
lines, PostgreSQL doesn't remove them physically, in-
stead it just marks them as useless. This process consumes less resources and time. The
same happens when you
UPDATE
rows; internally Postgres performs an insert command
by running the command for a new line with the same original data and marks the other
one as useless.
Thus, from time to time, it is necessary to carry out some procedures for collecting the
database garbage. The same will be discussed in the upcoming sections.