News for hackers. Stuff that matters.
Re:I Stopped Worrying and Learned to Love Denormalized Tables by brightball on Friday May 12, 2023 @10:55PM (#35925040)
The schemas always exist, it’s just a question of where: the database or the code that interacts with the database.
Re:I Stopped Worrying and Learned to Love Denormalized Tables by Spivak on Friday May 12, 2023 @11:29PM (#35925211)
I'm not entirely sure how true that actually rings because it's true by definition in some sense but having tables just be loose collection of typed nullable columns sans natural (maybe compound) primary keys is a very different experience from the kind of thing you expect. It's a schema in the way @dataclass is a schema and just ends up being a place to put stuff. It leads to very very few joins being necessary, natural keys map well to most problem domains, and foreign key constraints feel almost unnecessary since your real data is the key it's really hard to "lose" relationships.
Re:I Stopped Worrying and Learned to Love Denormalized Tables by BoiledCabbage on Friday May 12, 2023 @11:52PM (#35925334)
It feels to me like you're mixing the terms schema and relations/joins.

You can have a schema on a table without any foreign keys or relations. But in the above you seems to use those concepts interchangeably.

Taking OPs comments directly about schemas, it seems true to me.

Re:I Stopped Worrying and Learned to Love Denormalized Tables by alex_lav on Friday May 12, 2023 @11:23PM (#35925166)
If your app/architecture is effectively "BYO Schema", if one schema is wrong the other's aren't necessarily, and the cost of making a mistake is much lower. And I would also argue that even if your database is noramlized and has a strict schema, the code _still_ has the ability to implement its own schema after pulling data out.
Re:I Stopped Worrying and Learned to Love Denormalized Tables by cmrdporcupine on Saturday May 13, 2023 @06:32AM (#35927116)
The other way of putting it is this: the database gives you the chance to express facts (propositions) about the world in the form of tuples in relations ("rows" in "tables".)

You can, naturally, also express facts any other way you like.

But a relational DB gives you the tools to at least attempt the expression of those propositions in a way that makes them findable and provable later, with minimal pain.

Doing it in code, your mileage may vary.

And just like in written or spoken language communication, we can express facts poorly or incorrectly in either medium.

It's just that the relational model gives us a tool to help put discipline (and query flexibility) into that process. If we use the tool right, it helps us clarify our logic.