4 ms·
> you have a single authoritative view of the world, plus a secondary cached view of the world in a different language Yes. OTOH, with NoSQL you have no author
by nathan_long 8y ago
> you have a single authoritative view of the world, plus a secondary cached view of the world in a different language
Yes. OTOH, with NoSQL you have no authoritative schema; your code may allow for multiple different schemas, and your records may have multiple different schemas, and they could agree or disagree to any extent.
- _bxg1 8y agoYou can still have an authoritative schema, it just doesn't live in the DB itself. It would have to be defined in the code, generally.
- nathan_long 8y agoI would argue that it's not authoritative. Nothing guarantees that the records in the db match that schema; the closest you get to a guarantee is your diligence to 1) run a job mutating all records every time you change your in-code schema and 2) ensure that nothing but your latest application code can write to the db. OTOH, `\d users` in PostgreSQL is authoritative; there cannot be a row that does not conform to the fields, types, and constraints listed there.
- jt2190 8y ago> I would argue that it's not authoritative. I think the word you're looking for is "enforced". Where there are multiple schemas, one can certainly be the "authority", even if it's not enforced across all data.
- nathan_long 8y agoWhatever terminology you use, every place you loop through records doing stuff with them, you'll either have to decide what to do with oddly-shaped records or implicitly decide to let exceptions occur at that point. Whereas if PostgreSQL tells you that `user` has a `email character varying(255) NOT NULL`, you can be sure that every `user` does. The only place you need a conditional related to that is when trying to insert an invalid record.