Re:When to Avoid JSONB in a PostgreSQL Schema
by malisper on Thursday September 01, 2016 @08:19PM
(#12409849)
This is roughly EAV. EAV is where you have a with a schema:
EAV is typically considered to be an anti-pattern for several reasons: it becomes very expensive to rematerialize a entity with all of its attributes/values, it becomes difficult to have any kind of constraints on the values (this is also a problem with jsonb), and it's hard for the database to maintain good statistics on the values of different attributes as most databases don't keep multi-column statistics. Don't worry, I've had similar ideas before.
[ Parent
| on HN ]
Re:When to Avoid JSONB in a PostgreSQL Schema
by strommen on Friday September 02, 2016 @12:18AM
(#12410808)
EAV is an anti-pattern?
If you don't have JSONB, EAV is the only remotely-reasonable way to implement user-defined fields (e.g. product-specific attributes in e-commerce).
Re:When to Avoid JSONB in a PostgreSQL Schema
by malisper on Friday September 02, 2016 @01:03AM
(#12410961)
If you want to allow user-defined fields in a relational database, your realistic are either EAV or stuff json into a text column. EAV, if done extremely carefully, can be a good solution, but 99% of the time, it's going to be a huge pain.
Re:When to Avoid JSONB in a PostgreSQL Schema
by approachingtraj on Friday September 02, 2016 @05:47AM
(#12411937)
> stuff json into a text column
You did see the article was about JSONB, which is significantly more sophisticated than "json in a text column", yes?