r/PostgreSQL • u/pmz • Nov 02 '24
r/PostgreSQL • u/dmagda7817 • Jan 16 '25
Community Just Use Postgres...The Book
I’ve always thought that "Just Use Postgres" would make an excellent title and topic for a book. And we’ve partnered with Manning to bring it to life.

Looking forward to your feedback on the TOC and chapters that have already been released. The book is current in the Manning Early Access Program (MEAP), which lets read it while I continue to push it to the finish line.
r/PostgreSQL • u/Savalonavic • Jul 03 '26
Tools Postgres DB TUI
If not allowed, please delete.
Decided to create a fully featured DB TUI client for Postgres.
Fully customisable vim-style keybindings + a heap of other features.
https://github.com/davesavic/pgsavvy
Hopefully you find it as useful as I have!
r/PostgreSQL • u/Marmelab • Mar 05 '26
How-To 4 more underrated PostgreSQL features I wish I had known sooner
Last week I shared a post about 5 advanced features I wish I had known sooner, and to be completely honest, I didn't expect such a positive response! Seems like it resonated with quite many.. Thank you all for sharing your own tips in the comments, I learned quite a bit just from reading the replies.
Since the feedback was so positive, I figured I’d share 4 more features that gave me the same “wait… Postgres can do that?” moment. So here we go:
PARTITION BY: Window functions are a super powerful feature. They allow you to perform calculations across a set of table rows related to the current row. Pair them withPARTITION BYto group data without collapsing rows.ON CONFLICT: If you want to perform an “upsert” operation (insert or update), use theON CONFLICTclause. This allows you to insert a new row into a table, or update an existing row if a conflict occurs (e.g. a duplicate primary key).Composite types: If you're tired of JSON’s lack of structure, composite types let you enforce data types and constraints on the nested data.
Recursive CTEs: If you need to fetch an entire org chart, recursive CTEs let you traverse recursive data like hierarchy in a single query.
For anyone interested, I put together a more detailed write-up with examples covering all 9 features mentioned across both posts.
PostgreSQL really is the gift that keeps on giving. My next goal is to dive into Foreign Data Wrappers (FDW), the ability to query CSV files or remote databases as if they were local tables. It opens up so many possibilities! Has anyone here used it before?
Thanks again for all the love on the last post!
r/PostgreSQL • u/tirtha_s • Jan 27 '26
How-To How OpenAI Serves 800M Users with One Postgres Database: A Technical Deep Dive
Hey folks, I wrote a short deep dive on how OpenAI runs PostgreSQL for ChatGPT and what actually makes read replicas work in production.
Their setup is simple on paper (one primary, many replicas), but I’ve seen teams get burned by subtle issues once replicas are added.
The article focuses on things like read routing, replication lag, workload isolation, and common failure modes I’ve run into in real systems.
Sharing in case it’s useful, and I’d be interested to hear how others handle read replicas and consistency in production Postgres.
Edit:
The article originally had 9 rules. Now it has 8.
Rule 2 was titled "Your pooler will betray you with prepared statements" and warned about PgBouncer failing to track prepared statements in transaction pooling mode.
But u/fullofbones pointed out that PgBouncer 1.21 (released 2023) added prepared statement tracking via max_prepared_statements. The rule was outdated.
I thought about rewriting it as a broader connection pooling rule (transaction pooling doesn't preserve connection state). But that's a general pooling issue, not a replica-specific one.
r/PostgreSQL • u/db-master • Apr 30 '26
Community PostgreSQL 19 features I'm excited about
r/PostgreSQL • u/Blender-Fan • Sep 02 '25
Help Me! What's stopping me from just using JSON column instead of MongoDB?
Title
r/PostgreSQL • u/mdausmann • Jun 01 '25
How-To Down the rabbit hole with Full Text Search
I have just finished implementing a search solution for my project that integrates...
'standard' full text search using tsquery features
'fuzzy' matching using pg_trgm to cover typos and word variants
AI 'vector proximity' matching using pgVector to find items that are the same thing as other matches but share no keywords with the search
Algolia style query-based rules with trigger queries and ts_rewrite to handle special quirks of my solution domain
...all with 'just' PostgreSQL and extension features, no extra servers, no subscriptions and all with worst case response time of 250ms (most queries 15-20 ms) on ~100,000 rows.
Getting all this to work together was super not easy and I spent a lot of time deep diving the docs. I found a number of things that were not intuitive at all... here is a few that you might not have known.
ts_rank by default completely ignores the document length such that matching 5 words in 10 gives the same rank as matching 5 words in 1000... this is a very odd default IMO. To alter this behaviour you need to pass a normalisation param to ts_rank..... ts_rank(p.document, tsquery_sub, 1)... the '1' divides the rank by 1 + the logarithm of the document length and gave me sensible results.
using to_tsquery...:B to add 'rank' indicators to your ts_query is actually a 'vector source match directive', not really a rank setting operation (at least not directly) e.g. to_tsquery('english', 'monkeys:B'), effectively says "match 'monkeys' but only match against vector sources tagged with the 'B' rank". So if, for example you have tagged only the your notes field as ':B' using setweight(notes, 'B'), then "monkeys" will only match on the notes field. Yes of course 'B' has a lower weight by default so you are applying a weight to the term but only indirectly and this was a massive source of confusion for me.
Hope this is useful to somebody
r/PostgreSQL • u/cachedrive • Mar 05 '25
Community I replaced my entire tech stack with Postgres...
r/PostgreSQL • u/dougie-io • Oct 22 '20
This Man Used PostgreSQL To Expose 40K Voters Purged by Mistake
r/PostgreSQL • u/siren0x • Jul 24 '26
Community What's new in Postgres 19
r/PostgreSQL • u/lovol2 • Dec 26 '25
Projects 100% postgress search like Google
https://www.tigerdata.com/blog/you-dont-need-elasticsearch-bm25-is-now-in-postgres
Found this. Wanted to share, ill find it faster in the future!
But it has code and a working demo so seriously high effort from the company that made the blog post and MIT GitHub with code.
r/PostgreSQL • u/CubsFan1060 • Jun 09 '25
Tools Announcing open sourcing pgactive: active-active replication extension for PostgreSQL
r/PostgreSQL • u/fagnerbrack • Aug 14 '26
Tools Six SQL patterns I use to catch transaction fraud
analytics.fixelsmith.comr/PostgreSQL • u/CathalMullan • May 18 '26
Tools pgBackRest Will Continue!
r/PostgreSQL • u/craigkerstiens • Sep 17 '26
Feature What Is Happening with PostgreSQL 19?
r/PostgreSQL • u/Marmelab • Feb 24 '26
How-To 5 advanced PostgreSQL features I wish I knew sooner
A little context: A few months ago, I struggled with a planning system. I needed to ensure that no 2 plans could overlap for the same period. My first instinct was to write application-level validation, but something felt off. I thought to myself that surely PostgreSQL had a better way.
That’s when I discovered the EXCLUDE constraint. This reminded me of other PostgreSQL features I’d found over the years that made me think “Wait, Postgres can do that?!” Turns out, PostgreSQL is packed with a bunch of underrated (and often simply overlooked) features that can save you from writing complex application logic. So, I put together this list of advanced (but IMO incredibly practical) PostgreSQL features that I wish I had known sooner:
EXCLUDEconstraints: To avoid overlapping time slots
If you ever needed to prevent overlapping time slots for the same resource, then the EXCLUDE constraint is extremely useful. It enforces that no two rows can have overlapping ranges for the same key.
2. CHECK constraints: For validating data at the source
CHECK constraints allow you to specify that the value in a column must satisfy a Boolean expression. They enforce rules like "age must be between 0 and 120" or "end_date must be after start_date."
3. GENERATED columns: To let the database do the math
If you’re tired of calculating derived values in your app, you can let PostgreSQL handle it with GENERATED columns.
4. DISTINCT ON:
If you need the latest order for each customer, use DISTINCT ON. It’s cleaner than a GROUP BY with subqueries.
5. FILTER:
FILTER allows you to add a condition directly on the aggregate, like aggregating the sum of sales for a given category in a single statement.
I'm honestly amazed at how PostgreSQL keeps surprising me! Even after years of using it, I still discover features that make me question why I ever wrote complex application logic for things the database could handle natively.
Are there any other advanced PostgreSQL features I should know about?
r/PostgreSQL • u/jooosep • Aug 19 '26
Community Make sure to upgrade your PostgreSQL to the latest minor version ASAP
A friendly reminder to everyone: if you have not done it already then upgrade your PostgreSQL to the latest minor versions, as they include a fix for a high-impact CVE: CVE-2026-14669.