Book Image

PostgreSQL 13 Cookbook

By : Vallarapu Naga Avinash Kumar
Book Image

PostgreSQL 13 Cookbook

By: Vallarapu Naga Avinash Kumar

Overview of this book

PostgreSQL has become the most advanced open source database on the market. This book follows a step-by-step approach, guiding you effectively in deploying PostgreSQL in production environments. The book starts with an introduction to PostgreSQL and its architecture. You’ll cover common and not-so-common challenges faced while designing and managing the database. Next, the book focuses on backup and recovery strategies to ensure your database is steady and achieves optimal performance. Throughout the book, you’ll address key challenges such as maintaining reliability, data integrity, a fault-tolerant environment, a robust feature set, extensibility, consistency, and authentication. Moving ahead, you’ll learn how to manage a PostgreSQL cluster and explore replication features for high availability. Later chapters will assist you in building a secure PostgreSQL server, along with covering recipes for encrypting data in motion and data at rest. Finally, you’ll not only discover how to tune your database for optimal performance but also understand ways to monitor and manage maintenance activities, before learning how to perform PostgreSQL upgrades during downtime. By the end of this book, you’ll be well-versed with the essential PostgreSQL 13 features to build enterprise relational databases.
Table of Contents (14 chapters)
12
About Packt

Major version upgrade to PostgreSQL 13 using pg_upgrade with hard links for seamless downtime

In the previous recipe, we saw how pg_upgrade can be used to perform a major version in simple steps. However, it does take a long time to perform the upgrade this way when the database cluster is of several GBs or TBs in size. For this reason, we have an option in pg_upgrade to use hard links to make the upgrades finish in a few seconds.

When the hard links option is used, the data files are not copied from one cluster to another cluster. Instead, the files and directories created in the new cluster are linked to the files and directories in the old cluster. So, only the files and directories are created but the data copy is avoided when hard links are used. This only works when the upgrade is happening within the same filesystem. The only difference between the previous recipe and this recipe is that the upgrade using hard links is done by adding a -k argument to the pg_upgrade command used...