by KaiserPro · 11y ago · 0 comments
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?
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.