2 ms·
I'm using Postgres for a new project. After playing around with various NoSql stores, I've come to the following conclusion: If you want a super scalable event
by api 11y ago
I'm using Postgres for a new project. After playing around with various NoSql stores, I've come to the following conclusion:
If you want a super scalable eventually consistent database, use one of the more minimally structured global key value store type DBs like Cassandra. In this case you do not want SQL's guarantees or structure, so don't go there.
If you want a structured database with ACID guarantees, just use XXXXing SQL.
NoSql databases that have attempted to implement structured data, consistency guarantees, rules, ACID or near-ACID semantics, etc., have all started to basically just converge with SQL. They end up re-implementing SQL but with a less consistent, hackier query language and they miss spots. They've gone around the circle and re-invented the wheel and in many cases ended up with an inferior one to boot.
Sure SQL is old. So is math. SQL is rooted in set theory and other pieces of immortal mathematical truth. It's a great example of a software system designed around ageless mathematical concepts that will always be valid. It could use some syntactic modernization, but the core of it will be as useful in a million years as it is today. Learn how to properly structure a database (normalization, DRY, etc.) and how to use its more obscure abilities (esoteric joins) and you'll find that it's amazingly powerful.
PostgreSQL is fantastic because it's doing just that: a bit of modernization around a solid core. It gives you SQL when you want structured data, and it also give you JSON columns when you want to store blobs of unstructured data in the database. So it kind of gives you the best of both worlds: SQL plus a JSON document store. You can (to some extent) query your JSON columns too, though if you intend to do this a lot I'd recommend moving that data into SQL-land.
This facilitates a kind of iterated development where you throw temporary and less structured data into JSON columns, then if you discover later that this data wants to be more long-lived and structured you migrate it to real SQL columns. It's a very agile/YAGNI way of doing things -- do it quick at first, then optimize and clean up once you know what wants to live where and what's really important.
- chousuke 11y agoWhat I find interesting is that PostgreSQL is slowly gaining features like that make it a good fit for many use cases of NoSQL datastores. With the BDR extension, it might even be possible to use PostgreSQL to implement an eventually consistent multi-master document store. Of course, none of this comes "out of the box", but it's interesting to see the two technologies becoming more like each other.