JSONB on PostgreSQL:n binaarinen JSON-tyyppi — se tallentaa JSON-tietoa tehokkaassa, kyselykelpoiseissa ja indeksoitavissa muodossa. Sen avulla voit tallentaa joustavia, puolistruktuuroituja tietoja relaatiotietokantaan, yhdistäen relaatioeheyden ja NoSQL-tyylisen joustavuuden. Se on yksi Postgres:n tehokkaimpia ominaisuuksia.
JSONB vs JSON
JSON → stores the exact text (preserves whitespace/key order/duplicates), parsed each query
JSONB → stores a DECOMPOSED BINARY format → slightly slower to write, but MUCH faster
to query, and supports INDEXING and rich operators
→ Use JSONB in almost all cases (JSON only if you need exact text preservation).
