Jump to ratings and reviews
Rate this book

The Art of PostgreSQL

Rate this book
The book that teaches SQL to developers: Learn to replace thousands of lines of code with simple queries!

SQL is code
Learn how to deal with SQL in your developer workflow: versioning, testing, code reviewing, deployment. Best practice and tools are covered.

Practical examples
Learn advanced SQL with practical examples and datasets that help you get the most of the book! Every query solves a practical use case and is given in context.

Database modelling
The book covers (de-)normalisation with simple practical examples to dive into this seemingly complex topic, including Caching and Indexing Strategy.

SQL for developers
This book is for developers, covering advanced SQL techniques for data processing. Learn how to get exactly the result set you need in your application’s code!

Write efficient SQL
Writing efficient SQL is easier than it looks, and begins with database modeling and writing clear code. The book teaches you how to write fast queries!

Batteries included
The book comes with open data sets and instructions to get them so that you can run all the SQL queries at home, edit them and learn from them. Advanced psql setup is even included!

https://theartofpostgresql.com/

Unknown Binding

Published August 1, 2019

28 people are currently reading
281 people want to read

About the author

Dimitri Fontaine

2 books10 followers
PostgreSQL Major Contributor

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
24 (27%)
4 stars
32 (36%)
3 stars
19 (21%)
2 stars
9 (10%)
1 star
4 (4%)
Displaying 1 - 11 of 11 reviews
11 reviews4 followers
September 4, 2020
I decided to read this book after watching some of Dimitri's presentation on Youtube. So my expectations were high but I am disappointed. Book feels like composition of independent blog posts stitched together in random order. There are lot of links in the book some of them are dead. Examples aren't well explained. You can learn pretty much same things by visiting official postgres documentation.

4 reviews1 follower
March 20, 2020
This book is like fine dessert after a hearty meal. If you eat it by itself, it'll feel too coarse, too sugary, out of place and possible superfluous. Which is to say, even though the author doesn't explicitly indicate it, TAOP is the kind of book you get to/ you should read only once you've battled with Postgres, debated data layer design with your teammates, gotten around the quirks of SQL (read evaluation order & null aka three-valued logic), embraced a bit (if not enough) of modern SQL, scoured through Postgres' documentation and SO to get through misconceptions and lack of know-how, I could go on and on; in short, it is not a beginner's book even though its tone and reassurance might lead one to think so. It's the kind of book you read only once you're fully infatuated with PostgreSQL, broken up with it and ran back to her after getting super wine-drunk. Projecting much? Maybe. But at its best, this is the most enchanging love-letter to PostgreSQL ever penned. Thank you Dimitri! One aspect to note though, if you're experienced enough, you can opt for the cheaper version and set up the sample databases by yourself rather than getting the pricier version, this'll be as much learning as what you get from the book itself
Profile Image for Scott.
450 reviews11 followers
September 13, 2019
Read this for a book club at work. Not much to say, I'm not a big fan but it isn't too awful. The structure was odd, and there were quite a few grammatical oddities that make me believe this was self-published without an editor.
12 reviews8 followers
February 3, 2020
I left this book feeling much more comfortable in SQL, but also much less confident in SQL. This review is as much about SQL as the book itself, but as a member of the book’s target audience, these are concerns the book would do well to address.

It raised as many questions as it answered, so as an application developer, I don’t feel safe taking too hard a dependency on Postgres, in case I run into an unforeseen scalability issue and have to rewrite in favor of a custom data system.

I know I’m being pretentious, assuming I’ll have scaling problems, which are rare except for the biggest companies, and even then with particular usage patterns. But at some level, the book has to argue for postgres on perf grounds. Although it tries to argue for expressivity of SQL, it’s pretty clearly lacking compared to eg. the author’s Common LISP, despite the author compellingly arguing it’s more succinct than eg. Java or OO-style Python.

The book did not cover how to read an EXPLAIN plan, which I think would have helped. I realize the book chose to keep that out of scope, which is why I’ll try follow it up with one diving in to db perf. The problem is that when you ask me to write more complex SQL queries, I lose the ability to plan about their perf, in 1) will the latency become unacceptable with more rows and 2) will it monopolize resources with too many queries and degrade throughput, and 3) will even “easy” queries have high latency, but I won’t guess until I’ve wrote myself into a hole?

If I’m only writing simple queries, and aggregating in eg. a Python app layer, I can at least reason about their performance, even if it’s poor.
Profile Image for Vlad Ardelean.
157 reviews34 followers
May 6, 2020
Good book!
I learned a lot of PostgreSQL techniques. I enjoyed the interviews section.
On the negative side: A little bit too preachy, opinionated the reasoning is not nuanced. It's like the author is trying to convince me that I should ALWAYS put as much business logic as possible in SQL.

More in detail, I took about 100 notes from the book.
It's basically a collection of tricks, queries, interviews and explanations. Interesting to read, but not easy to write comments about.

The most interesting things I learned are:
* lateral joins
* grouping sets
* always use timestamps with timezones (they take up the same amount of space as those without
)
* you can write stored procedures in.....wait....waaaaait.... XSLT!
* you can write stored procedures in Python :P
* psycopg2 supports an asynchronous mode
* pg_tgrm - interesting concept, and interesting operators (operators which compare a given word to another, and operators which compare a given word with any word within a piece of text)
* intarray extension - has nice querying capabilities `'1&2&!(3|4)' in my_array` (this would take a lot of where clauses, which would be less efficient, as they wouldn't be applied at the same time when looking over the array..maybe?
* HyperLogLog operators and functions for creating unions out of HLLs. Well, I knew about HLL, but never got the chance to think too deeply about it.

While this is a nice book, I think it was a little too expensive. Also I expected a better structure. This book is written as a mixture of cookbooks/theory/articles/exercises/interviews, all thrown in there :P
Profile Image for Hamza.
32 reviews9 followers
January 27, 2025
Good PostgreSQL Refresher.

Changed my perspective on the place of a database in computing systems as a whole.
Reinforced the idea that when you learn an important technical concept to fulfil an immediate need (e.g task at work), you need to take out time to understand the full range of possibilities offered by said concept, and then optionally decide to go deep, if need be.

Overall I learnt a lot from reading it.

Things I didn't like.
- The datasets used were not provided by the author in some public repo. Several of the 'public' datasets linked in the book were no longer available online.
- I thought the book had too many typos
- I wish all the concepts taught in the book were done by analysing a single, comprehensive dataset. I had to keep switching across multiple, very different datasets.
Profile Image for Miha Rekar.
135 reviews20 followers
November 22, 2023
This Art of PostgreSQL is a mixed bag. Its format resembles a patchwork of blog posts rather than a coherent text, and numerous links within are dead, undermining its utility. The book is also marred by grammatical errors and a lack of clear explanations, suggesting there wasn't any professional editing. While it offers a basic introduction to Postgres, it fails to instill confidence in its application, especially for developers concerned about scalability. There are definitely some gems inside that not everyone knows, but the way it's described and structured made an impression like "this books about everything and nothing in the same time".
Profile Image for Myroslav.
2 reviews
December 26, 2022
Maybe, my expectations were too high because of positive recommendations on the twitter.
IMO this book needs more love in terms of structure and probably some editor review.
There are definitely some gems inside that not everyone knows, but the way it's described and structured made impression a-la "this books about everything and nothing in the same time"
14 reviews
December 17, 2023
definitely not for a beginner, you should know SQL / RDBMS etc before the start. That's not an issue, but book is pretty unstructured, postgresql concepts are mixed with datasets review, python code and even lisp code (not something you'd expect to see in postgres book, ha?)
problem is I cannot find the audience I can recommend this book - there are better books for beginner / experienced users
Profile Image for Omar ElKhatib.
17 reviews
January 15, 2023
One of the best books I've read on postgres,
if you think you know databases,
Maybe read that book.
Displaying 1 - 11 of 11 reviews

Can't find what you're looking for?

Get help and learn more about the design.