4 ms·
TFA doesn't say that this is _the_ JSONB of PostgreSQL fame, but I assume it must be. JSONB is a brilliant binary JSON format. What makes it brilliant is that
by cryptonector 3y ago
TFA doesn't say that this is _the_ JSONB of PostgreSQL fame, but I assume it must be. JSONB is a brilliant binary JSON format. What makes it brilliant is that arrays and objects (which when serialized are a sort of array) are encoded by having N-1 lengths of values then 1 offset to the Nth value, then N-1 lengths of values then... The idea is that lengths are going to be similar, while offsets never are, so using lengths makes JSONB more compressible, but offsets are needed to enable random access, so if you store mostly lengths and sometimes offsets you can get O(1)ish random access while still retaining compressibility.
Originally JSONB used only offsets, but that made it incompressible. That held up a PostgreSQL release for some time while they figured out what to do about it.
- ks2048 3y agoLink? My reading last time I looked at this was that the sqlite and postgres “jsonb” were different.
- cryptonector 3y agoThis is the first time that SQLite3 is getting JSONB. Idk if it's the same as PG's. TFA doesn't say. I assume they are the same or similar because I seriously doubt that D.R. Hipp is unaware of PG's JSONB, but then for that reason I am surprised that he didn't say in TFA.
- cryptonector 3y agohttps://sqlite.org/draft/jsonb.html https://sqlite.org/draft/jsonb.html says they're NOT the same.
- anarazel 3y agohttps://sqlite.org/draft/jsonb.html https://sqlite.org/draft/jsonb.html references postgres: > The "JSONB" name is inspired by PostgreSQL, but the on-disk format for SQLite's JSONB is not the same as PostgreSQL's. The two formats have the same name, but they have wildly different internal representations and are not in any way binary compatible.
- cryptonector 3y agoAh, https://sqlite.org/draft/jsonb.html https://sqlite.org/draft/jsonb.html says: > The "JSONB" name is inspired by PostgreSQL, but the on-disk format for SQLite's JSONB is not the same as PostgreSQL's. The two formats have the same name, but they have wildly different internal representations and are not in any way binary compatible.
- masklinn 3y ago> TFA doesn't say that this is _the_ JSONB of PostgreSQL fame, but I assume it must be. Definitely is not: Hipp states > JSONB is also slightly smaller than text JSON in most cases (about 5% or 10% smaller) Whereas in Postgres jsonb commonly takes 10~20% more space than json.