News for hackers. Stuff that matters.
Re:What Happened to Vivaldi Social? by semiquaver on Saturday July 29, 2023 @03:44PM (#36923816)
Joins are cheap. Wide tables are often a sign that a data-model is a bit too CRUDdy. Foreign key relationships often do a much better job modeling optionality/cardinality in relational systems.

In this case, a `user_uris` table with non-nullable columns and a unique constraint on `user_id` is the first option that comes to mind.

Re:What Happened to Vivaldi Social? by kaoD on Saturday July 29, 2023 @03:57PM (#36923942)
For a table with a single column (plus FK), isn't LEFT JOIN isomorphic to just having a NULLABLE column (and much better at data locality)?

It might prevent error if you only rely on INNER JOIN but that's rarely the case at least for me (you often want to access the record anyways).

Much safer to deal with the NULL at the application level.

Re:What Happened to Vivaldi Social? by traxys on Saturday July 29, 2023 @03:53PM (#36923904)
I had a situation where I'm not really sure I could have used something else than null: I need a value in one of two columns exactly (meaning one is NULL and the other not).

You can build a constraint to check that if it's in the same table, but across tables it seems to be a bit more complex right ?

Re:What Happened to Vivaldi Social? by snmx999 on Saturday July 29, 2023 @05:20PM (#36924756)
You could have the first column indicate the type of value and the second column the value. If you now have your columns named "a" and "b" you could have the first column named "type" only allowing values "a" or "b" and the second column would be "value" where the actual value is stored.
Re:What Happened to Vivaldi Social? by ngc248 on Sunday July 30, 2023 @10:29AM (#36931461)
At scale ... it is better to use CQRS ... sou you have a transaction model which is fully normalized and a read nly model which is wide, if you really want to use a RDBMS.