🔥 The DB Grill 🔥

Where database blog posts get flame-broiled to perfection

Text Search with MongoDB and PostgreSQL
Originally from dev.to/feed/franckpachot
September 19, 2025 • Roasted by Rick "The Relic" Thompson Read Original Article

Well, bless your heart. I just finished reading this little article on my 24-line green screen emulator, and I have to say, I haven't been this impressed since we successfully ran a seven-tape restore without a single checksum error back in '89. It was a Tuesday. We had pizza to celebrate.

It's just wonderful to see you young folks discovering the magic of full-text search. And with emojis, no less! Back in my day, we had to encode our data in EBCDIC on punch cards, and if you wanted to search for something, you wrote a COBOL program that would take six hours to run a sequential scan on a VSAM file. Using a cartoon apple as a search term? We didn't even have lowercase letters until '83, sonny. The sheer audacity is breathtaking.

I must admit, this "dynamic indexing" thing is a real hoot. You just... point it at the data and it figures it out? Astounding. We used to spend weeks planning our B-tree structures, defining fixed-length fields in our copybooks, and arguing with the systems programmers about disk allocation on the mainframe. The idea that you can just throw unstructured fruit salad at a database and expect it to make sense of it... well, that's the kind of thinking that leads to a CICS region crashing on a Friday afternoon.

And the ranking algorithm! BM25, you call it? A refinement of TF-IDF. How... revolutionary.

Term Frequency (TF): More occurrences of a term in a document increase its relevance score... Inverse Document Frequency (IDF): Terms that appear in fewer documents receive higher weighting. Length Normalization: Matches in shorter documents contribute more to relevance...

It's incredible. It's almost exactly like the experimental "Text Information Retrieval Facility/MVS" IBM was trying to sell us for DB2 back in 1985. We had a guy named Stan who wrote the same logic in about 800 lines of PL/I. It chewed through so much CPU the lights would dim in the data center, but by golly, it could tell you which quarterly report mentioned "synergy" the most. Looks like you've finally caught up. Glad to see the old ideas getting a new coat of paint. And you don't even have to submit it as a batch job with JCL! Progress.

I almost spit my Sanka all over my keyboard when I read this part:

Crucially, changes made in other documents can influence the score of any given document, unlike in traditional indexes...

My boy, you're describing a catastrophic failure of data independence as if it's a feature. My query results for Document A can change because someone added an unrelated Document Z? That's not a feature; that's a nightmare. That's how you fail an audit. Back in my day, a query was deterministic. It was a contract. This sounds like chaos. It sounds like every query is a roll of the dice depending on what some other process is doing. Good luck explaining that to the compliance department.

And then the PostgreSQL part. It's almost adorable. You found that the stable, reliable, grown-up database needed an extension to do this newfangled voodoo search. Of course it does! That's called modularity. You don't bolt every possible feature onto the core engine. You load what you need. It's called discipline, a concept as foreign to these modern "document stores" as a balanced budget.

But the best part, the real knee-slapper, was this little adventure with ParadeDB:

You see? You had to normalize your data. You had to impose a schema, even a tiny one. You came this close to discovering the foundational principles of relational databases all by yourself. I'm so proud. You're learning that data needs structure, not just a "bag of fruit."

So, congratulations on your in-depth analysis. It's a wonderful demonstration of how, with enough processing power and venture capital, you can almost perfectly replicate a 40-year-old concept. You just have to add a REST API, call it "schema-less," and pretend you invented it.

Now if you'll excuse me, I have to go check on a REORG job that's been running since Thursday. Some things never change.