Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
PostgreSQL 16 Administration Cookbook

You're reading from  PostgreSQL 16 Administration Cookbook

Product type Book
Published in Dec 2023
Publisher Packt
ISBN-13 9781835460580
Pages 636 pages
Edition 1st Edition
Languages
Authors (5):
Gianni Ciolli Gianni Ciolli
Profile icon Gianni Ciolli
Boriss Mejías Boriss Mejías
Profile icon Boriss Mejías
Jimmy Angelakos Jimmy Angelakos
Profile icon Jimmy Angelakos
Vibhor Kumar Vibhor Kumar
Profile icon Vibhor Kumar
Simon Riggs Simon Riggs
Profile icon Simon Riggs
View More author details

Table of Contents (15) Chapters

Preface First Steps Exploring the Database Server Configuration Server Control Tables and Data Security Database Administration Monitoring and Diagnosis Regular Maintenance Performance and Concurrency Backup and Recovery Replication and Upgrades Other Books You May Enjoy
Index

Removing issues that cause bloat

Bloat is disk space previously used by tables that is available for reuse by the database but no longer by the filesystem. It can be caused by long-running queries or long-running write transactions that execute alongside write-heavy workloads. Resolving that is mostly down to understanding the workloads that are running on the server.

Getting ready

Look at the age of the oldest snapshots that are running, like this:

postgres=# SELECT now() -
  CASE
  WHEN backend_xid IS NOT NULL
  THEN xact_start
  ELSE query_start END
  AS age
, pid
, backend_xid AS xid
, backend_xmin AS xmin
, state
FROM  pg_stat_activity
WHERE backend_type = 'client backend'
ORDER BY 1 DESC;
age             |  pid  |   xid    |   xmin   |        state       
----------------+-------+----------+----------+------------------
00:00:25.791098 | 27624 |          | 10671262 | active
00:00:08.018103 | 27591 |          |          | idle in transaction
00:00:00.002444...
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}