Book Image

Learning Heroku Postgres

By : Patrick Rafael de Oliveira Espake
Book Image

Learning Heroku Postgres

By: Patrick Rafael de Oliveira Espake

Overview of this book

Table of Contents (17 chapters)
Learning Heroku Postgres
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Keyword List
Index

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, instead 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.

Database VACUUM

The VACUUM procedure is responsible for cleaning this set of useless lines in your database, thus ensuring increased performance.

Usually, the default setting of...