Search icon
Subscription
0
Cart icon
Close icon
You have no products in your basket yet
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Troubleshooting PostgreSQL

You're reading from  Troubleshooting PostgreSQL

Product type Book
Published in Mar 2015
Publisher Packt
ISBN-13 9781783555314
Pages 164 pages
Edition 1st Edition
Languages

Table of Contents (17) Chapters

Troubleshooting PostgreSQL
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. Installing PostgreSQL 2. Creating Data Structures 3. Handling Indexes 4. Reading Data Efficiently and Correctly 5. Getting Transactions and Locking Right 6. Writing Proper Procedures 7. PostgreSQL Monitoring 8. Fixing Backups and Replication 9. Handling Hardware and Software Disasters 10. A Standard Approach to Troubleshooting Index

Inspecting internal information


Once the basics (locking, slow queries, and so on) are done, our attention can be turned to more sophisticated inspections.

Looking inside a table

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.

The pgstattuple module has been created to detect those problems. Before the module can be used, it has to be loaded:

test=# CREATE EXTENSION pgstattuple;
CREATE EXTENSION

Basically, pgstattuple is easy to use. All you have to do is call the pgstattuple function and pass a table name as a parameter. No columns are returned:

test=# \x...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}