JSONB è il tipo JSON binario di PostgreSQL — memorizza i dati JSON in un formato efficiente, interrogabile e indicizzabile. Ti permette di archiviare dati flessibili e semi-strutturati in un database relazionale, combinando l'integrità relazionale con la flessibilità simile a NoSQL. È una delle funzionalità più potenti di Postgres.
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).
