3 ms·
This is my primary stack now, except for Typescript instead of Javascript, and I absolutely love it. First, the ideological thing: flexibility is an awful thin
by golergka 6y ago
This is my primary stack now, except for Typescript instead of Javascript, and I absolutely love it.
First, the ideological thing: flexibility is an awful thing for user's data and logical relationships within it. The fact that with RDBMS you have to define your schema and follow it, makes many classes of erros that would have been corrupted data at operations to being exceptions at development: PostgreSQL just won't let you shoot yourself in the foot like that. And with pgtyped, which I'm growing to love, you don't even have to write any boilerplate: just write plain straightforward SQL, run verification against your test database, and get all of your types for free.
But that's not even the most important part; what I absolutely love about SQL is my ability to delegate huge amounts of work from my app server to my db server, saving a lot of latency and CPU. It may not be that critical for things when you just update one row in the 'users' table, but when you have O(n) updates and up, it's just great to be able to do things directly in the database.
And in rare occasions where you absolutely have to use non-structured data (or data with a lot of different data types that don't deserve their own columns), jsonb is useful and pretty damn fast if you think throught the schema and make use of the GIN indexes.
- smashah 6y agothanks for the pgtyped recommendation! I guess I was just frustrated with the constant moaning from the DB side when schemas were constantly being reconsidered. JSONb to the rescue though!