The Art of PostgreSQLDimitri Fontaine
The Art of PostgreSQL
Turn Thousands of Lines of Code Into Simple Queries
by Dimitri Fontaine · first published 2019
25mentions
20recommended by
21HN commenters
2019–2026first – last mentioned
95% recommend5% neutral
Why HN recommends it
Thorough, example-driven SQL and PostgreSQL guide mixing real-world problems with general advice; praised for taking SQL from basic storage to fuller use and suited to novices or rusty developers.
Summarised by Claude from recommending comments
The book that teaches SQL to developers: Learn to replace thousands of lines of code with simple queries!
Affiliate links. As an Amazon Associate I earn from qualifying purchases.








Apart from Designing Data-Intensive Applications by Martin Kleppmann, which is already suggested here, my other favorites are - - Designing Distributed Systems by Brendan Burns - The Art of PostgreSQL by Dimitri Fontaine - The Algorithm Design Manual by Steven S. Skiena
on “Ask HN: Book Recommendations” ↗…starting with logic & discrete math Ralph Kimball and Margy Ross, The Data Warehouse Toolkit -- even if you're in an OLTP context, it's useful to know about warehousing techniques Dmitri Fontaine, The Art of PostgreSQL -- cookbook approach to modern SQL with plenty of explanations Not a book but Heinz Klein and Kalle Lyytinen's paper "Towards a New Understanding of Data Modeling" in the Software Development and Reality…
on “Ask HN: What are some good books for SQL/DBA?” ↗My favorite book for learning SQL is “The Art of PostgreSQL”. https://theartofpostgresql.com/ I found the combination of real-world problems, general SQL advice, and the broad range of topics to be a really good book. It took my SQL from “the database is not much more than a place to persist application data” to “the application is not much more than a way to match commands to the database”. It’s
on “SQLBolt – Interactive lessons and exercises to learn SQL” ↗I found Dimitri Fontaine's https://theartofpostgresql.com/ advanced. Learned lots of new tricks out of it.
on “Discovering less-known Postgres v12 features” ↗I feel that pain! I knew MySQL so well that it felt risky to use a different database, yet if I used it on a non-serious project, how would I get real-world experience? I learned a lot from a book from one of the core contributors to Postgres - https://theartofpostgresql.com/. It has actual real world examples with realistic datasets to experiment with.
on “Why Uber Engineering Switched from Postgres to MySQL (2016)” ↗I don't know about _eye opening_, but The Art of PostgreSQL really changed the way I work for the better. Like a lot of people, I used to be one that would pull all my data into Python for processing, Pandas-style. Once I learned how to do it all directly in PG everything became trivial. [0] https://theartofpostgresql.com/
on “Ask HN: What are the most eye-opening textbooks you have ever read?” ↗https://theartofpostgresql.com/
on “SQL Murder Mystery” ↗This one's great: https://theartofpostgresql.com/
on “In Praise of PostgreSQL” ↗For those interested in learning more about PostreSQL, I'd recommend the book by the author of this tool[1]. It's bee a great resource for me. It's a great introduction to SQL with a focus on postgres. (FWIW, it was called "Mastering PostgreSQL" when I bought it, but as far as I can tell, the site I linked is just an updated version). 1: https://theartofpostgresql.com/
on “Pgloader – migrate your data from any SQL database into PostgreSQL” ↗For me it's really learning Django with https://wsvincent.com/books/djangoforprofessionals really learning postgres with https://theartofpostgresql.com/ trying out typescript on a side project and migrating one project from heroku to docker + terraform
on “Ask HN: What Technologies to Learn in 2020?” ↗I've only used it as a reference, but the art of postgresql is pretty solid. In general any webdev who isn't skilled at SQL is missing out on an easy way to level up. SQL is crazy powerful, versatile, and scalable, and takes a small amount of time to gain proficiency, and stays with you. I methodically read one 350 page book in 2012 and still feel I understand SQL better than most I come across. T
on “Ask HN: Self-taught webdev with lots of free time. What should I learn?” ↗The Art of Postgresql. As the title suggests, it's targeted for Postgresql. However it has a full section on data modeling, another section on data types. It's packed with lots of examples and reasoning. I feel it gives you a good mix of theoretical background and hands on immediate experience. You'll find your way around what is (in my worthless opinion) the best database engine, and the pgsql s
on “Old, Good Database Design” ↗The blog post[1] by the author about ORMs was what convinced me to purchase the book. I've had too many discussions with colleagues and tech friends struggling with N+1 problems and processing too much stuff in the application when they use mainstream ORMs to think it is a good idea. ORMs make the regular CRUD stuff simpler, but seem to make some more complex queries and transactions harder. There
on “SQLBolt – Interactive lessons and exercises to learn SQL” ↗The Art of PostgreSQL (https://theartofpostgresql.com) by Dimitri Fontaine, also the author of PGLoader (https://github.com/dimitri/pgloader)
on “Ask HN: Good Postgres Book(s)?” ↗Thank you! It's just a table of contents. :-) And there is a book about temporal data I want to write first. . . . But it's awesome to hear someone is interested. EDIT: to plug a couple other independent-author Postgres books on my short-term reading list, these look awesome (but not quite the same focus): - https://postgrespro.com/community/books/internals - https://theartofpostgresql.com/
on “Postgres: The Next Generation” ↗