Object-oriented or relational? Why not both?
For many years, we tried to fit the business data into a normalised table structure. We used Object-Relational Mappers, which was a constant battle on how to map unfitting models.
Then document databases like MongoDB came along and got traffic.
Still, many people wanted guarantees they had in relational databases, they also wanted to reuse muscle memory related to operations and other tooling.
Now we have the choice as we have #JSONB data type implemented by #PostgreSQL and then by MySQL, SQLite.
The B in JSONB stands for binary. It looks like a JSON, it quacks like a JSON, but it's not JSON. And thanks to that, it's powerful.
When you're storing JSON data in JSONB, it's parsed, tokenised, and stored in a tree-like structure. Types are preserved, and a hierarchical structure is also preserved, and thanks to that, you can index it and efficiently query it.
I'm super happy that in recent years, I have had the opportunity to use Postgresql and JSONB, first in Marten and now in Pongo. I didn't look back. JSONB has its cons, but for most typical line-of-business applications, they're negligible.
I finally wrote an intro in #ArchitectureWeekly about how JSONB works, check it, tell me how you liked it and share with your friends!
And most importantly, play with it on your own 😊
https://www.architecture-weekly.com/p/postgresql-jsonb-powerful-storage