Of the PostgreSQL books on sale from major publishers when we checked, only one was written for PostgreSQL 18, which shipped in September 2025. That does not make the rest of the best PostgreSQL books out of date, because the hard parts (MVCC, vacuum, query plans, replication) work the same way in 18. It does mean you should know which version a book teaches before you buy it, and which examples need a small change on a current server.
Nine PostgreSQL books made this list: one for learning Postgres from scratch, two for developers building on it, three for the people who run it, two on slow queries and bad habits, and one for Rails teams. For each you will see the version it teaches, what its code repository pins, and what we would weigh before paying. We checked editions, stock and prices against Amazon’s catalog and checked every book against the PostgreSQL 18.6 release notes and docs in October 2026.
Pick a PostgreSQL Book by What You Do
Start from your job, not from the thickest book. A developer who writes queries all day gets more from a book on query plans than from a DBA cookbook, and a new DBA gets more from recipes than from a book about Rails. These are the books we would hand to each reader:
- Best for beginners: Learn PostgreSQL, 2nd Edition
- Best for application developers: Just Use Postgres!
- Best for PostgreSQL 18 and AI: AI-Ready PostgreSQL 18
- Best for working DBAs: PostgreSQL 16 Administration Cookbook
- Best for slow queries: PostgreSQL Query Optimization, 2nd Edition
- Best deep reference: Mastering PostgreSQL 17
The other three fill narrower gaps. PostgreSQL Mistakes and How to Avoid Them collects the errors other teams already paid for, so you can skip making them yourself. Mastering PostgreSQL Administration is the only book here with full chapters on moving off Oracle, and High Performance PostgreSQL for Rails is the one to buy if Active Record writes most of your SQL. If you have never written a SELECT, read our SQL learning path first, because every book below assumes you can already read a join.
Check the PostgreSQL Version Before You Buy
We built the shortlist from the publishers’ own shelves rather than Amazon’s best-seller pages. A plain search for PostgreSQL books in 2026 surfaces dozens of self-published “PostgreSQL 18” titles at $3 to $13, from authors with no track record you can check. The Amazon catalog pass covered Packt, O’Reilly, Manning, Apress, No Starch and Pragmatic. Every pick is a print edition sold and shipped by Amazon when we checked, and each cover matches the edition we link.
Then we looked at what each book was written against, since that decides how much of it you will have to translate. Where a publisher ships code, we read the repository: Learn PostgreSQL builds its chapter images from postgres:16.0, AI-Ready PostgreSQL 18 refuses to set up on anything older than 18, and Just Use Postgres! starts its container from postgres:17.2. Where there is no code, the version comes from the publisher’s page. We did not work through every chapter of every book, so the topic coverage below comes from contents pages, repositories and publisher descriptions, and we say which.
| Book | Publisher, year | Pages (Amazon) | Teaches | That version’s support ends | Level |
|---|---|---|---|---|---|
| Learn PostgreSQL, 2nd Ed | Packt, 2023 | 744 | PostgreSQL 16 | November 2028 | Beginner |
| Just Use Postgres! | Manning, 2025 | 400 | PostgreSQL 17 (container 17.2) | November 2029 | Intermediate developer |
| AI-Ready PostgreSQL 18 | Packt, 2026 | 580 | PostgreSQL 18 or newer | November 2030 | Intermediate developer |
| Mastering PostgreSQL 17 | Packt, 2024 | 442 | PostgreSQL 17 | November 2029 | Intermediate to advanced |
| PostgreSQL 16 Administration Cookbook | Packt, 2023 | 636 | PostgreSQL 16 | November 2028 | Working DBA |
| PostgreSQL Query Optimization, 2nd Ed | Apress, 2024 | 369 | PostgreSQL 15 examples | November 2027 | Intermediate |
| PostgreSQL Mistakes and How to Avoid Them | Manning, 2025 | 232 | Not stated | n/a | Beginner to intermediate |
| Mastering PostgreSQL Administration | Apress, 2025 | 750 | Not stated | n/a | Intermediate to advanced DBA |
| High Performance PostgreSQL for Rails | Pragmatic, 2024 | 456 | PostgreSQL 16, Rails 7.1 | November 2028 | Intermediate developer |
The support column comes from the project’s versioning policy, which keeps each major release for five years. It tells you how long a book’s exact commands stay valid on a supported server: a PostgreSQL 16 book still matches a version that gets security fixes until 2028. Nothing on this list was written for 14, whose community support ends November 12, 2026. The project scheduled the next major release, 19, for October 2026, and the 18 changes further down carry into it.
A few titles that still sell were left out on purpose:
- PostgreSQL: Up and Running, 3rd Edition (O’Reilly, 2017), a PostgreSQL 10 book
- Mastering PostgreSQL 15 (Packt, 2023), replaced by the 17 edition below
- PostgreSQL DBA (v17 to v13), 2nd Edition (self-published, 2025)
Up and Running was the classic, and its 4th edition is on preorder for May 2027, but the edition you can buy today was written for PostgreSQL 10, which left community support in November 2022. The self-published DBA guide was on this page in March. We dropped it because we found no publisher contents page or code repository to check its claims against, and every other pick has one.
1. Learn PostgreSQL, 2nd Edition
Luca Ferrari and Enrico Pirozzi wrote the beginner book on this list that runs furthest, from first install to replication in one volume. It starts with installing a cluster and connecting with psql, then moves through users, roles, DDL, window functions, triggers and partitioning. The second half covers what a new DBA meets in month two: MVCC and WAL, extensions, query tuning, logging, backups, configuration and replication.
The companion repository is why we put it first. Most chapters have their own Docker image, all 21 of its PostgreSQL Dockerfiles build from postgres:16.0, and chapter 5’s compose file, for example, publishes the server on host port 65001 with an explicit PGDATA. So you follow chapter 17’s streaming replication on a ready-made primary and standby instead of building them by hand, and you can throw the whole lab away when you are done.
Timing is the catch. Packt lists a 3rd edition, “with PostgreSQL 18 or higher”, for November 10, 2026, and it was on preorder when we checked. If you can wait until November 10, wait. If you want to start now, the 2nd edition teaches a version that is supported until 2028, and the jump from 16 to 18 is covered in the changes section below. It was about $44 when we checked. Check the current price on Amazon.
2. Just Use Postgres!
Denis Magda’s book argues that most teams do not need a separate search engine, queue or vector store, because Postgres and its extensions already do the job. Most chapters take one workload and build it in Postgres: transactions, full-text search, JSON documents, time series with TimescaleDB, geospatial queries with PostGIS, a message queue with pgmq and vector search with pgvector and HNSW indexes. Manning pitches it at application developers who already know basic SQL, and that’s the right reader.
Magda’s listings repository pins the server. Listing 1.1 starts postgres:17.2 in Docker, and listing 1.5 already calls random(1,10), a function form that arrived in PostgreSQL 17. A 16 server has no two-argument random(), so that line errors out there, and you should run the listings on 17 or newer. On 18 there is a second trap: the official image moved its data directory, so the book’s -v postgres-volume:/var/lib/postgresql/data mount needs to become /var/lib/postgresql, on a fresh volume name, because the 18 image refuses to start on a data volume left over from 17. The vector chapters pair well with our pgvector install guide.
A DBA will not get much from it. There’s no backup, upgrade or failover depth here, because that is not the book’s job. At about $60 it was also the most expensive book here except the Rails title when we checked. Check the current price on Amazon.
3. AI-Ready PostgreSQL 18
Vibhor Kumar and Marc Linster wrote the one major-publisher book on this list built for PostgreSQL 18, and it treats Postgres as one system for transactions, analytics and vectors. Kumar also co-wrote the Administration Cookbook below, and the foreword comes from Ed Boyajian, EDB’s former CEO. Packt published it in April 2026, which makes it the newest book here.
The companion repository builds one e-commerce platform across five databases on a single server: a reference catalogue, east and west regional stores fed by logical replication, a star-schema analytics warehouse, and an AI database that runs semantic search with pgvector and OpenAI embeddings plus a RAG function. Its setup script checks for PostgreSQL 18 or newer with wal_level = logical and aborts if they are missing, and it pulls in extensions such as pgaudit, pg_squeeze, pg_stat_statements, pg_trgm and plpython3u along the way.
That setup is the trade-in. You need a server where you can install those extensions, and the AI chapters call OpenAI for embeddings, so plan on an API key, so it’s heavier to follow than Just Use Postgres!, which runs from one container. If AI search is not on your roadmap, the other developer pick covers more ground for less setup. It was about $50 when we checked. Check the current price on Amazon.
4. Mastering PostgreSQL 17
Hans-Jürgen Schönig has published six editions of this book since the PostgreSQL 10 one in 2018, skipping only 14 and 16, and the 6th edition covers 17. It reads as one long reference for the intermediate user: what’s new in 17, transactions and locking, indexing, window functions and JSON, execution plans and tuning, stored procedures, security and replication. If you searched for “Mastering PostgreSQL 15 by Schönig”, this is that book two releases later, and the 15 edition still on sale is the one to skip.
Don’t buy it for a lab. Packt’s repository for this edition holds a licence and a one-line README, nothing else, and it has not changed since May 2024. You type the examples from the page. That suits a reader who already runs Postgres and wants the reasoning behind a setting, and it frustrates a beginner who learns by running code. We found no PostgreSQL 18 edition announced on Amazon yet. It was about $42 when we checked. Check the current price on Amazon.
5. PostgreSQL 16 Administration Cookbook
This is the book a working DBA keeps open. Gianni Ciolli, Boriss Mejías, Jimmy Angelakos, Vibhor Kumar and Simon Riggs wrote more than 180 recipes in problem and solution form, so you jump to “the standby is lagging” or “restore one table” without reading the chapters before it. The edition adds batch loading with MERGE, security changes and deployment on Kubernetes or with TPA and Ansible, according to the publisher’s listing.

Packt has opened a code repository for a PostgreSQL 19 edition, but nothing newer than 16 is on sale or preorder yet, so 16 is what you get. For a recipe book that matters less than it sounds: backup tools, replication slots and the pg_hba rules change slowly. Two recipes need your judgment on 18, though. Upgrades now hit the data checksum default, and any recipe that writes md5 into pg_hba.conf or sets an MD5 password now earns a deprecation warning, both covered in the table further down. Pair the replication recipes with our streaming replication walkthrough if you want a tested second opinion.
Recipe books do not build a mental model, and this one does not try, so read it alongside a book that explains how the engine works. It was the cheapest pick here at about $32, well under its $54.99 list price, when we checked. Check the current price on Amazon.
6. PostgreSQL Query Optimization, 2nd Edition
Henrietta Dombrovskaya, Boris Novikov and Anna Bailliekova wrote the book on making slow queries fast, and it focuses on queries rather than server tuning or hardware. You learn to read execution plans, to tell short queries from long ones and treat them differently, to pick the index that helps, and to avoid the access patterns ORMs generate. Dombrovskaya is a database architect at DRW and runs the Chicago PostgreSQL User Group, and the examples feel like they came from production rather than a textbook.

Apress says the second edition’s examples run on Postgres 15 against the newest version of the postgres_air sample database, a real flight-booking schema large enough that a bad plan actually hurts. That’s the oldest version on this list, and on 18 some plans will look better than the book’s, because 18 added skip scans on multicolumn B-tree indexes and uses indexes for more OR conditions. Read those chapters as “why the planner chose this” rather than “you will see exactly this plan”. It was about $37 when we checked. Check the current price on Amazon.
7. PostgreSQL Mistakes and How to Avoid Them
Jimmy Angelakos, a PostgreSQL Contributor and one of the cookbook’s authors, catalogues the mistakes he keeps seeing: wrong data types, misused features, bad SQL, configuration and security errors, failed upgrades and high availability set up wrong. Each one gets a short story, a demo and an explanation of the engine behaviour behind it. At 232 pages it is the shortest book here, and it is the one we’d give a team before their first production launch.
The code repository is small: a schema, a data script, a customer dump and a few Python scripts for chapters 2, 5 and 7. It pins no server version, which suits a book about habits rather than features. The mistakes do not expire with a release, so it ages more slowly than the version-specific books here if you’re unsure which release you’ll run. It’s not a tutorial, though, and it won’t teach you Postgres from zero. It was about $49 when we checked. Check the current price on Amazon.
8. Mastering PostgreSQL Administration
Y V Ravi Kumar, Arun Kumar Samayam and Phani Kadambari come from the Oracle world, and it shows in what this 733-page book covers that the others don’t. Besides installation from source and yum, backup and recovery, VACUUM and REINDEX, and monitoring with Grafana and pgAdmin, it walks through migrating an Oracle schema with ora2pg and replicating between Oracle and PostgreSQL in both directions with Oracle GoldenGate. Ravi Kumar is an Oracle Certified Master, and the migration material runs to whole chapters rather than the usual single appendix.

Buy it when you’re the Oracle DBA who just inherited Postgres, or the team planning the migration. Apress doesn’t state which PostgreSQL release the book was written against, and its install chapters lean on yum, so Debian and Ubuntu readers will translate package steps as they go. For a plain DBA reference with no Oracle in the picture, the cookbook above does more per page. It was about $43 when we checked. Check the current price on Amazon.
9. High Performance PostgreSQL for Rails
Andrew Atkinson’s book is the only one here built around a single sample application, and it works from that app down to the database. You build “Rideshare”, a sample Rails app, then fix it like a real one: constraints that stop bad data, keyset pagination instead of OFFSET, bulk loads with COPY and MERGE, read replicas with Active Record’s multiple databases, partitioning with pgslice, full-text search, and Rails caching and background jobs without Redis or Sidekiq.
Pragmatic lists the requirements plainly: PostgreSQL 16, Ruby 3.2, Rails 7.1 and Docker, and a second printing with reader fixes went out in August 2025. The Postgres chapters on replication and partitioning are useful to any developer, but you’ll get half the value if you don’t write Ruby. Stock was limited when we checked, at about $62. Check the current price and stock on Amazon.
Adapt Book Examples to PostgreSQL 18
Most of what these books teach carries straight over to 18, because the SQL they use still runs. The changes that bite are in defaults, upgrades and the Docker image, which is exactly where a reader following a book step by step gets stuck. Each row comes from the PostgreSQL 18 release notes or the official Docker image documentation:
| Change in PostgreSQL 18 | What a 15 to 17 book shows | What to do on 18 |
|---|---|---|
| initdb enables data checksums by default | New clusters without checksums | pg_upgrade needs matching settings, so create the new cluster with --no-data-checksums when the old one has none |
| MD5 password authentication deprecated | md5 lines in pg_hba.conf, roles carried over from old clusters | New passwords have defaulted to scram-sha-256 since 14; reset migrated MD5 passwords and switch pg_hba.conf to scram-sha-256, because CREATE ROLE and ALTER ROLE now warn on MD5 |
| Generated columns are virtual by default | GENERATED ALWAYS AS (...) STORED | The book’s STORED syntax still works; leave STORED off and 18 computes the column at read time, but keep STORED if the expression calls a user-defined function or type, which virtual columns can’t use |
| pg_upgrade keeps planner statistics | Run ANALYZE on everything after an upgrade | Extended statistics still don’t carry over; vacuumdb --analyze-only --missing-stats-only fills the gaps |
Asynchronous I/O, io_method defaults to worker | Tuning chapters built around OS readahead | effective_io_concurrency now defaults to 16; read the new io_method settings before copying old tuning advice |
uuidv7() added | gen_random_uuid() for random v4 keys | Use uuidv7() for time-ordered keys that index better |
Official Docker image stores data under /var/lib/postgresql/18/docker | Volumes mounted at /var/lib/postgresql/data | Mount the volume at /var/lib/postgresql on the 18 image |
The checksum row catches the most people, because it only shows up during an upgrade. A cluster built from an older book’s instructions has no checksums and a fresh 18 cluster has them, so pg_upgrade refuses the pair until you match them. Read our PostgreSQL 18 install guide for a current server to practise on, and the point-in-time recovery guide before you try an upgrade on anything you care about.
Wait for These Editions, or Read Free
Three books on the way will change this list, so it’s worth knowing their dates before you spend money on the edition they replace:
- Learn PostgreSQL, 3rd Edition (Packt), for PostgreSQL 18, due November 10, 2026
- Enterprise PostgreSQL (Apress), on high availability, scaling and upgrades, due November 18, 2026
- PostgreSQL: Up and Running, 4th Edition (O’Reilly), due May 4, 2027
All three were on preorder when we checked, and preorder dates slip, so treat them as targets. Two free books are worth your time. Hironobu Suzuki’s The Internals of PostgreSQL is an online book, and Egor Rogov’s PostgreSQL 14 Internals, which Postgres Professional publishes as a free PDF with a printed copy for sale. It explains MVCC, the buffer cache, WAL, locks, query execution and all six built-in index types. Version 14 leaves support in November 2026, but the internals it describes are still how 18 works, and either one makes the other books on this list easier to follow. When you want the same ideas across other engines too, our pick of database internals books covers storage engines, MVCC and WAL beyond Postgres.
Build a Reading Path for Your Role
Two books in the right order beat five on a shelf. Pick the path that matches the work you’ll do in the next six months:
- New to PostgreSQL: Learn PostgreSQL, then PostgreSQL Mistakes
- Application developer: Just Use Postgres!, then PostgreSQL Query Optimization
- Building AI search or RAG on Postgres: AI-Ready PostgreSQL 18, then Just Use Postgres!
- Rails developer: High Performance PostgreSQL for Rails, then PostgreSQL Query Optimization
- New DBA: the Administration Cookbook, then Mastering PostgreSQL 17
- Oracle DBA moving over: Mastering PostgreSQL Administration, then the Administration Cookbook
Whichever path you take, run the examples on a real server rather than reading them. A DBA path ends at high availability, and our Patroni and HAProxy guide is where the cookbook’s replication recipes turn into a cluster that fails over. Developers who end up writing stored procedures should add Procedural Programming with PostgreSQL PL/pgSQL from Apress, the one narrow book we’d still recommend.





