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

Parallel backup and restore using pg_dump and pg_restore

For a tiny database, pg_dump need not run in parallel using multiple connections. But, when there are databases of several GBs or TBs in size, you may wish to run pg_dump using more parallel jobs. If pg_dump can run in parallel using more CPUs without utilizing all the available server resources, it can complete faster.

Multiple processes are spawned when pg_dump is invoked in parallel mode. For that reason, it is not wise to allocate all the available CPUs on the database server to pg_dump, if the database server is serving any traffic.

In this recipe, we shall discuss how a large database's backup and restore can be performed faster using parallel features in pg_dump.

Getting ready

In order to use pg_dump either locally or remotely, the postgresql-13 package must be installed on the server from the pg_dump being performed.

Additionally, it is better to observe the CPU load and allocate the safest number of parallel processes...