json and jsonb - Postgresql
Postgresql provides a data-type
jsonb to save data from JSON format. There are two ways for it - using
jsonb. This article will clarify difference in short terms.
jsonb are very similar to each other. The key difference is -
jsonb is binary representation of
as per postgresql documentation.
- Pros -
- Improved efficiency
- Postgresql provides query interface for these types. So a direct query for any key in column can be made.
- Simple database schema
- Cons -
- Slight overhead to convert into binary form.
- Aggregate queries are slower (due to lack of statistics).
- Due to large table footprints may take large disk space.