Mastering PostgreSQL 11

Aleksandr Shitik
Aleksandr Shitik

I write my own posts and books, and review movies and books. Expert in cosmology and astronomy, IT, productivity, and planning.

Mastering PostgreSQL 11
Hans-Jürgen Schönig
Genres: Programming
Year of publication: 2019
Year of reading: 2020
My rating: Good
Number of reads: 1
Total pages: 353
Summary (pages): 13
Original language of publication: English
Translations to other languages: Russian, Chinese

General Description

The book, around 350 pages long, consists of 13 chapters. In addition to text, its content includes a large amount of code (primarily SQL queries) and various tables. The reading difficulty level is approximately intermediate. Each chapter is supported by a brief summary.

Brief Overview

When I read the book, it was still the 11th version. However, the author keeps it updated—the first chapter typically covers the latest database innovations. After a short introduction, the chapter on transactions and locks begins—unsurprisingly, since every operation in PostgreSQL is executed within a transaction. Both simple transactions and more complex, longer ones using SAVEPOINT are discussed. FOR SHARE and FOR UPDATE, transaction isolation levels, storage optimization, and other topics are also covered here.

Moving on. There’s a chapter on index creation, their types (B‑tree, GIN, GiST, etc.), purposes, and applications. The chapter is very informative and detailed. Next is a short chapter on advanced functions (grouping, sorting, aggregation, window functions)—also quite informative. After that, there’s a chapter on logging. Query logs, logging configuration, and system queries are discussed.

Next comes a large chapter on query optimization. Examples of internal optimization (performed by the optimizer before executing a query) as well as external methods, where the developer can improve the query, are discussed. JOINs, partitioning, and much more are also covered here.

Following this is a chapter on stored procedures. I’m not particularly inclined to delegate business logic (even a small part) to the database, so I can’t fully appreciate this chapter, though I admit there are situations where stored procedures might be appropriate.

Next is the chapter on security. It includes network security (pg_hba), access rights, role delegation, and user deletion. It shows how to protect data at different system levels. Quite interesting and useful.

After this, there are several chapters on backups. The first chapter focuses on working with backups: creating and restoring them. The second one is about replication. Both are very informative and engaging.

The next chapter covers PostgreSQL extensions. Methods for installing and working with extensions (contrib and third-party) are described. The most in-demand modules that enhance PostgreSQL’s functionality are highlighted.

One of the last chapters focuses on PostgreSQL troubleshooting. Practical approaches to analyzing activity (pg_stat_activity), identifying bottlenecks, logging tools, working with indexes, memory, and much more are discussed. Finally, the last chapter is dedicated to migrating your current database (e.g., MySQL) to PostgreSQL.

Opinion

A book with practical examples on one of the popular relational databases—PostgreSQL. What I definitely liked about the book is its smooth flow. All the chapters are very sequential and complement each other. At times, the book felt slightly challenging, as I’ve never delved so deeply into PostgreSQL. However, it can be very useful for those who want to learn the intricacies of the database and, for example, differentiate between GIN and GiST indexes or understand the locking modes like ACCESS SHARE, ROW SHARE, SHARE UPDATE EXCLUSIVE, and others. On the other hand, the book also covers many popular topics such as transactions, profiling, replication, and much more, which are used daily, so the book will undoubtedly be very useful for all backend developers.

Вверх