Lesson 2.313mIntermediate8.8k students

Data types and JSONB

Postgres has rich types, and JSONB for the genuinely unstructured remainder. Reaching for JSONB too early throws away every guarantee above.

This lesson sits in Schema Design, part of PostgreSQL for Developers. It assumes what came before it and leads directly into the next lesson in the module.

In this lesson you will

  • Pick precise types for time, money, and identifiers
  • Use JSONB for genuinely variable data only
  • Index inside a JSONB column when you must query it

Pro tip

JSONB is for data whose shape you genuinely cannot know. It is not a shortcut past schema design.

Resources