3 ms·
The JSON appears to be highly structured, so why isn't it stored in a structured way? I mean invoices I'd assume by their definition made up of structured data
by KaiserPro 12y ago
The JSON appears to be highly structured, so why isn't it stored in a structured way?
I mean invoices I'd assume by their definition made up of structured data:
The buyer (and associated data), the items ordered (and associated data) total volume and price.
As all the relationships are fairly simple and rigid, surely you'd want them in SQL?
- tomiko_nakamura 12y agoI think that if you're using JSONB for data that can be easily stored in a proper tabular form (aka relation), you're doing it wrong. No doubt there will be people using it this way, though, and maybe there are cases where it really makes sense. What JSONB makes much easier is storing data that are not a good fit for relational paradigm. For example if you don't know the exact structure (e.g. if you don't know what keys to expect), you can't reasonably decompose that into relational schema. This is the case with mail headers, for example - it's highly variable, every client/MTA can define their own headers, and so on. You could decompose that into EAV model (yuck), use tables with generic PARAM_1, ..., PARAM_N columns (yuck!), or you can just stuff that into a JSONB column.