r/PostgreSQL • • Nov 02 '24

Community It's 2024. Why Does PostgreSQL Still Dominate?

Thumbnail i-programmer.info
144 Upvotes

r/PostgreSQL • • Jan 16 '25

Community Just Use Postgres...The Book

143 Upvotes

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 • • Jul 03 '26

Tools Postgres DB TUI

142 Upvotes

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 • • Mar 05 '26

How-To 4 more underrated PostgreSQL features I wish I had known sooner

138 Upvotes

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:

  1. 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 with PARTITION BY to group data without collapsing rows.

  2. ON CONFLICT: If you want to perform an “upsert” operation (insert or update), use the ON CONFLICT clause. 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).

  3. 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.

  4. 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 • • Jan 27 '26

How-To How OpenAI Serves 800M Users with One Postgres Database: A Technical Deep Dive

Thumbnail
open.substack.com
136 Upvotes

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 • • Apr 30 '26

Community PostgreSQL 19 features I'm excited about

Thumbnail
bytebase.com
128 Upvotes

r/PostgreSQL • • Oct 08 '19

Spotted in Austin, TX

Thumbnail
imgur.com
128 Upvotes

r/PostgreSQL • • Sep 24 '20

PostgreSQL 13 Released!

Thumbnail
postgresql.org
125 Upvotes

r/PostgreSQL • • Sep 02 '25

Help Me! What's stopping me from just using JSON column instead of MongoDB?

124 Upvotes

Title


r/PostgreSQL • • Jun 01 '25

How-To Down the rabbit hole with Full Text Search

121 Upvotes

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.

  1. 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.

  2. 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 • • Oct 13 '22

Feature PostgreSQL 15 Released!

Thumbnail
postgresql.org
121 Upvotes

r/PostgreSQL • • Mar 05 '25

Community I replaced my entire tech stack with Postgres...

Thumbnail
youtube.com
119 Upvotes

r/PostgreSQL • • Sep 30 '21

PostgreSQL 14 Released!

Thumbnail
postgresql.org
119 Upvotes

r/PostgreSQL • • Oct 22 '20

This Man Used PostgreSQL To Expose 40K Voters Purged by Mistake

Thumbnail
youtube.com
117 Upvotes

r/PostgreSQL • • Jul 24 '26

Community What's new in Postgres 19

Thumbnail
planetscale.com
113 Upvotes

r/PostgreSQL • • Dec 26 '25

Projects 100% postgress search like Google

112 Upvotes

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 • • Jun 09 '25

Tools Announcing open sourcing pgactive: active-active replication extension for PostgreSQL

Thumbnail
aws.amazon.com
112 Upvotes

r/PostgreSQL • • Jun 05 '23

Should we go dark on the 12th?

Thumbnail
self.linux
111 Upvotes

r/PostgreSQL • • Aug 14 '26

Tools Six SQL patterns I use to catch transaction fraud

Thumbnail analytics.fixelsmith.com
110 Upvotes

r/PostgreSQL • • May 18 '26

Tools pgBackRest Will Continue!

Thumbnail
pgbackrest.org
110 Upvotes

r/PostgreSQL • • Sep 17 '26

Feature What Is Happening with PostgreSQL 19?

Thumbnail
snowflake.com
109 Upvotes

r/PostgreSQL • • Feb 24 '26

How-To 5 advanced PostgreSQL features I wish I knew sooner

108 Upvotes

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:

  1. EXCLUDE constraints: 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 • • Oct 03 '19

PostgreSQL 12 Released!

Thumbnail
postgresql.org
106 Upvotes

r/PostgreSQL • • Aug 19 '26

Community Make sure to upgrade your PostgreSQL to the latest minor version ASAP

105 Upvotes

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.