When I first started looking into Postgres, there were very few books in bookstores (yes, those still existed - that was a long time ago) and the only online resource was the Postgres mailing list. Today, we see new Postgres books popping up regularly.
In this post, I will review four of my favorite books. The selection criteria are purely subjective and based on lessons learned with customers, partners, and teams at EDB. Personally, I learn from books, and I don’t have much use for the ‘Google and Go’ approach whose goal is to acquire the least amount of knowledge required to achieve a task. I believe databases deserve a deeper appreciation so a knowledgeable developer or DBA will make better decisions.
One key factor influencing my recommendations is a recent change in the Postgres user landscape. Our interactions used to be almost exclusively with infrastructure DBAs and DBAs focused on resolving performance issues in specific queries. In the last year or two, that picture has changed. We now see a lot more interest from developers and architects who want to use Postgres to maximum advantage. That probably goes hand-in-hand with Postgres having become universally available on every cloud and deployment platform, and supported by a multitude of vendors (see The Future of Postgres in a Multi-Cloud World: A Developer Perspective). The emergence of the developer/architect influenced my list of book recommendations.
Nota bene: I didn’t read all Postgres books on the market! These are not the best books - they are the books I like best. I learn from books - your mileage may vary.
<TL;DR>
|
|
|
|
|
|
|
|
|
|
|
PostgreSQL: Up and Running
PostgreSQL: Up and Running: A Practical Guide to the Advanced Open Source Database by Regina O. Obe and Leo S. Hsu
A great introduction to Postgres by two authors who are well known and highly respected in the Postgres and PostGIS world. This is a very approachable book that focuses on essentials, without being superficial. It is not an exhaustive list of everything one might need to know, but it focuses on everything that is needed to get started and be successful. The following quote is an illustration of that approach:
Teaching you all there is to know about privileges could take a few chapters. What we’ll aim for in this section instead is to give you enough information to get up and running and to guide you around some of the more non intuitive land mines that could either lock you out completely or expose your server inappropriately.
I really like the multiple links to other resources, such as depesz.com. This tells me that the authors care about sharing knowledge, not just showcasing their accomplishments.
I really like the hands-on approach, for example to psql, where the authors include an exhaustive list of commands, and a couple of nice examples showing how psql can be used to solve problems."
Sample psql-generated HTML report (p. 71)
The book is 275 well-written pages and was last updated for PostgreSQL 10.
Mastering PostgreSQL12
Mastering PostgreSQL 12: Expert techniques to build scalable, reliable, and fault-tolerant database applications, 3rd Edition by Hans-Jürgen Schönig
This is a book for the advanced Postgres user. It builds on many years of hands-on problem solving for customers in all areas of debugging, tuning, and generally making things work. The book goes into significant detail and may represent a steep learning curve for the novice. For example, on Page 33 the author dives into a description of transaction isolation levels - the “I” in ACID.
Hans-Jürgen provides a good explanation of key concepts, and also dives into advanced features that really highlight what makes Postgres special, such as Operator Classes. He gives an in-detail example for how to create an Operator Class, without having to revert to C programming! A very elegant example highlighting a key strength of Postgres.
The book is 427 pages loaded with good information. Sometimes a little academic or encyclopedic, but definitely recommended reading for the advanced Postgres user.
PostgreSQL 11 Administration Cookbook
PostgreSQL 11 Administration Cookbook: Over 175 recipes for database administrators to manage enterprise databases Paperback by Simon Riggs, Gianni Ciolli, Sudheer Kumar Meesala
A book of recipes for the Postgres DBA. Over 175 useful prescriptions that follow a standard formula: What it is (e.g., how to choose good names for database objects), Getting Ready (any kind of pre-work, in this case: understand purpose and key use cases); How to do it; followed by There is More (in this case a structured way to name indexes and triggers).
The recipes range from the conceptual, such as how to name tables and indexes, to the very advanced, such as ways to estimate the number of rows in very large tables without using SELECT COUNT(*).
In over 600 pages the authors provide hands-on advice to address specific tasks and problems. A very useful compendium for the Postgres DBA.
The Art of PostgreSQL
The Art of PostgreSQL - Turn Thousands of Lines of Code into Simple Queries by Dmitri Fontaine
The subtitle gives it away: Turn thousands of Lines of Code into Simple Queries. This is a book for developers. It comes with lots of code examples, and data dumps ready to be loaded into Postgres. The book is very hands-on and definitely focuses on coders and application developers. If you are new to Postgres, then this may not be the book to get started with, unless you are in a team and others take care of the initial installation of the database, setting up psql etc.
Throughout the book, Dimitri points out repeatedly that application developers who take advantage of stored procedures, advanced data types, and database extensions such as PostGIS, can create more efficient applications that are also more likely to be 'correct'.
Early in the book, Dimitri has a very poignant example showing how moving certain logic into the application layer can easily impact or even eliminate any notion of transaction isolation (the "I" in ACID). He also shows that finding the right balance of where to put the business logic — in the database or into the application server — can make applications significantly faster, and reduces the coding effort greatly.
Several interviews throughout the book help make the points about the underlying development philosophy. For example, the section on NoSQL is followed by an interview with Álvaro Hernández Tortosa, who discusses the advantages of a multi-model approach in Postgres, where we have relational and document-oriented data modeling in the same context. Other interviews are with Yohann Gabory a Python Django expert, Markus Winand the author of “SQL Performance Explained”, Grégoire Hubert, a well-known web and PHP developer, Kris Jenkins, author of the YeSQL library, and Craig Kerstiens of CitusData
These four books provide learning paths for developers, DBAs, and architects who want to get into Postgres, and for those who want to go deep. Which book(s) one chooses depends on the professional focus and the ambition - all of them are good and worth reading.
The guidance and advice provided in these books are equally applicable to PostgreSQL, the open source database, and to EDB Postgres Advanced Server, EDB’s Oracle compatible version of Postgres.
Use Postgres - Get Stuff Done!
For a detailed review of the four books, please watch the on-demand webinar, My Favorite PostgreSQL Books.