PostgreSQL 14 Administration Cookbook
eBook - ePub

PostgreSQL 14 Administration Cookbook

  1. 608 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

PostgreSQL 14 Administration Cookbook

About this book

Administer, monitor, and replicate your PostgreSQL 14 database for efficient database management and maintenanceKey Features• Troubleshoot and tackle any administration and management problems in PostgreSQL 14• Find expert techniques for monitoring, fine-tuning, and securing your database• Adopt efficient replication for high availability with PostgreSQL 14Book DescriptionPostgreSQL is a powerful, open-source database management system with an enviable reputation for high performance and stability. With many new features in its arsenal, PostgreSQL 14 allows you to scale up your PostgreSQL infrastructure. With this book, you'll take a step-by-step, recipe-based approach to effective PostgreSQL administration.This book will get you up and running with all the latest features of PostgreSQL 14 while helping you explore the entire database ecosystem. You'll learn how to tackle a variety of problems and pain points you may face as a database administrator such as creating tables, managing views, improving performance, and securing your database. As you make progress, the book will draw attention to important topics such as monitoring roles, validating backups, regular maintenance, and recovery of your PostgreSQL 14 database. This will help you understand roles, ensuring high availability, concurrency, and replication. Along with updated recipes, this book touches upon important areas like using generated columns, TOAST compression, PostgreSQL on the cloud, and much more.By the end of this PostgreSQL book, you'll have gained the knowledge you need to manage your PostgreSQL 14 database efficiently, both in the cloud and on-premise.What you will learn• Plan, manage, and maintain PostgreSQL databases in production• Work with the newly introduced features of PostgreSQL 14• Use pgAdmin or OmniDB to perform database administrator (DBA) tasks• Use psql to write accurate and repeatable scripts• Understand how to tackle real-world data issues with the help of examples• Select and implement robust backup and recovery techniques in PostgreSQL 14• Deploy best practices for planning and designing live databasesWho this book is forThis Postgres 14 book is for database administrators, data architects, database developers, and anyone with an interest in planning and running live production databases using PostgreSQL 14. Those looking for hands-on solutions to any problem associated with PostgreSQL 14 administration will also find this book useful. Some experience with handling PostgreSQL databases will help you to make the most out of this book, however, it is a useful resource even if you are just beginning your Postgres journey.

Frequently asked questions

Yes, you can cancel anytime from the Subscription tab in your account settings on the Perlego website. Your subscription will stay active until the end of your current billing period. Learn how to cancel your subscription.
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
Perlego offers two plans: Essential and Complete
  • Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
  • Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Both plans are available with monthly, semester, or annual billing cycles.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Yes! You can use the Perlego app on both iOS or Android devices to read anytime, anywhere — even offline. Perfect for commutes or when you’re on the go.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app.
Yes, you can access PostgreSQL 14 Administration Cookbook by Simon Riggs,Gianni Ciolli in PDF and/or ePUB format, as well as other popular books in Computer Science & Computer Science General. We have over one million books available in our catalogue for you to explore.

Chapter 1: First Steps

PostgreSQL is a feature-rich, general-purpose database-management system. It's a complex piece of software, but every journey begins with the first step.
We'll start with your first connection. Many people fall at the first hurdle, so we'll try not to skip past that too swiftly. We'll quickly move on to enabling remote users, and from there, we will move on to getting access through GUI administration tools.
We will also introduce the psql query tool, which is the tool used to load our sample database, as well as many other examples in the book.
For additional help, we've included a few useful recipes that you may need for reference.
In this chapter, we will cover the following recipes:
  • Introducing PostgreSQL
  • How to get PostgreSQL
  • Connecting to the PostgreSQL server
  • Enabling access for network/remote users
  • Using the pgAdmin GUI tool
  • Using the OmniDB GUI tool
  • Using the psql query and scripting tool
  • Changing your password securely
  • Avoiding hardcoding your password
  • Using a connection service file
  • Troubleshooting a failed connection
  • PostgreSQL in the cloud

Introducing PostgreSQL 14

PostgreSQL is an advanced SQL database server, available on a wide range of platforms. One of the clearest benefits of PostgreSQL is that it is open source, meaning that you have a very permissive license to install, use, and distribute PostgreSQL, without paying anyone any fees or royalties. On top of that, PostgreSQL is known as a database that stays up for long periods and requires little or no maintenance, in most cases. Overall, PostgreSQL provides a very low total cost of ownership.
PostgreSQL is also known for its huge range of advanced features, developed over the course of more than 30 years of continuous development and enhancement. Originally developed by the Database Research Group at the University of California, Berkeley, PostgreSQL is now developed and maintained by a huge army of developers and contributors. Many of these contributors have full-time jobs related to PostgreSQL, working as designers, developers, database administrators, and trainers. Some, but not many, of these contributors work for companies that specialize in support for PostgreSQL. No single company owns PostgreSQL, nor are you required (or even encouraged) to register your usage.
PostgreSQL has the following main features:
  • Excellent SQL standards compliance, up to SQL:2016.
  • Client-server architecture.
  • It has a highly concurrent design, where readers and writers don't block each other.
  • It is highly configurable and extensible for many types of applications.
  • It has excellent scalability and performance, with extensive tuning features.
  • It offers support for many kinds of data models, such as relational, post-relational (arrays and nested relations via record types), document (JSON and XML), and key/value.

What makes PostgreSQL different?

The PostgreSQL project focuses on the following objectives:
  • Robust, high-quality software with maintainable, well-commented code
  • Low-maintenance administration for both embedded and enterprise use
  • Standards-compliant SQL, interoperability, and compatibility
  • Performance, security, and high availability
What surprises many people is that PostgreSQL's feature set is more similar to Oracle or SQL Server than it is to MySQL. The only connection between MySQL and PostgreSQL is that these two projects are open source; apart from that, the features and philosophies are almost totally different.
One of the key features of Oracle, since Oracle 7, has been snapshot isolation, where readers don't block writers and writers don't block readers. You may be surprised to learn that PostgreSQL was the first database to be designed with this feature, and it offers a complete implementation. In PostgreSQL, this feature is called Multiversion Concurrency Control (MVCC), and we will discuss this in more detail later in the book.
PostgreSQL is a general-purpose database management system. You define the database that you want to manage with it. PostgreSQL offers you many ways in which to work. You can either use a normalized database model, augmented with features such as arrays and record subtypes, or use a fully dynamic schema with the help of JSONB and an extension named hstore. PostgreSQL also allows you to create your own server-side functions in any of a dozen different languages.
PostgreSQL is highly extensible, so you can add your own data types, operators, index types, and functional languages. You can even override different parts of the system, using plugins to alter the execution of commands, or add a new query optimizer.
All of these features offer a huge range of implementation options to software architects. There are many ways out of trouble when building applications and maintaining them over long periods of time. Regrettably, we simply don't have space in this book for all the cool features for developers; this book is about administration, maintenance, and backup.
In the early days, when PostgreSQL was still a research database, the focus was solely on the cool new features. Over the last 20 years, enormous amounts of code have been rewritten and improved, giving us one of the largest and most stable software servers available for operational use.
Who is using PostgreSQL? Prominent users include Apple, BASF, Genentech, Heroku, IMDB, Skype, McAfee, NTT, the UK Met Office, and the US National Weather Service. Early in 2010, PostgreSQL received well in excess of 1,000,000 downloads per year, according to data submitted to the European Commission, which concluded that "PostgreSQL is considered by many database users to be a credible alternative." PostgreSQL has gone on from there to be even more popular.
We nee...

Table of contents

  1. PostgreSQL 14 Administration Cookbook
  2. Contributors
  3. About the authors
  4. About the reviewers
  5. Preface
  6. Chapter 1: First Steps
  7. Chapter 2: Exploring the Database
  8. Chapter 3: Server Configuration
  9. Chapter 4: Server Control
  10. Chapter 5: Tables and Data
  11. Chapter 6: Security
  12. Chapter 7: Database Administration
  13. Chapter 8: Monitoring and Diagnosis
  14. Chapter 9: Regular Maintenance
  15. Chapter 10: Performance and Concurrency
  16. Chapter 11: Backup and Recovery
  17. Chapter 12: Replication and Upgrades
  18. Other Books You May Enjoy