Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

There are two reasons to use a jsonb column:

1. To store JSON. There's a pattern where when your webserver calls into some third-party API, you store the raw API response in a JSONB column, and then process the response from there. This gives you an auditable paper trail if you need to debug issues coming from that 3rd-party API.

2. To store sum types. SQL not supporting sum types is arguably the biggest deficiency when modelling data in SQL databases. There are several workarounds - one of them being "just chuck it in a JSONB column and validate it in the application" - but none of the workarounds is particularly great.



I would add:

3. End-user extra fields. Stuff you don't care about, but someone somewhere does.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: