I'm deciding between using nullable fields or jsonb to store user profile. Initially, this would be used for contacts:
phone. I anticipate that there may be other columns added later, such as
website. Additionally, there may be other non-related fields, such as settings/preferences, saved searches, etc.
I've already decided that I don't want to use any form of key-value store (or any schema involving many-to-many relations) for this, unless there's an extremely good reason for it.
Pros of jsonb:
- Can store multiple values for each "column" if necessary
- Adding new field just needs JS coding and documentation
Cons of jsonb:
- Overhead of storing the "column" name as a string for each "row"
- Wonky to perform comparison queries (I think N/A to my usage scenario)
- Have to expect the unexpected
Anything else to add to this list of pros/cons? As much as I'd like to simply use nullable columns, I think it would be negligent to ignore jsonb - it seems like a compelling choice.