JSONB คือชนิดข้อมูล JSON แบบ binary ของ PostgreSQL มันจัดเก็บข้อมูล JSON ในรูปแบบที่มีประสิทธิภาพ query ได้ และ index ได้ มันช่วยให้คุณจัดเก็บข้อมูลแบบยืดหยุ่นและกึ่งโครงสร้างใน relational database ผสานความถูกต้องเชิง relational เข้ากับความยืดหยุ่นแบบ NoSQL เป็นหนึ่งในความสามารถที่ทรงพลังที่สุดของ Postgres
JSONB เทียบกับ 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).
