Once the basics (locking, slow queries, and so on) are done, our attention can be turned to more sophisticated inspections.
As already described in this book, PostgreSQL uses a mechanism called Multi-Version Concurrency Control (MVCC). The beauty of this system is that more than one version of a row can exist at the same time, which is the perfect way to scale up the system. However, this also means that space on the disk might be wasted if too many versions of too many rows exist. This problem is generally called table bloat. If tables grow too large and inefficient, performance problems are likely to arise.
pgstattuple module has been created to detect those problems. Before the module ...