Rich Types for PostgreSQLs
Rich Types are PostgreSQL's data types and features that go beyond basic numbers and text. They include JSONB for document data, arrays, ranges, enums, UUIDs and timestamps with time zone, plus window functions, common table expressions and full-text search. They let one database handle varied data without extra systems.
Stage: SQL in PostgreSQL · Part of the PostgreSQL roadmap · Last reviewed 19 November 2026
What to learn in Rich Types
- Store and query semi-structured data with JSONB operators
- Use arrays and enums where they model the data naturally
- Write a window function such as ROW_NUMBER over a partition
- Structure complex queries with common table expressions
- Run a full-text search using tsvector and tsquery
Rich Types interview questions
What is the difference between JSON and JSONB in PostgreSQL?
JSON stores the exact text, preserving whitespace and key order, and reparses it on use. JSONB stores a decomposed binary form that is faster to query and can be indexed with GIN, but it does not keep duplicate keys or order.
What does a window function do that GROUP BY cannot?
A window function computes values across related rows, such as a running total or rank, while keeping every row in the output. GROUP BY collapses rows into one per group, so you lose the individual detail.
Where Rich Types fits in the PostgreSQL roadmap
Rich Types belongs to the SQL in PostgreSQL stage (beginner level), which takes about 23 hours. Tutorial and language.
Other units in this stage
Back to the full PostgreSQL roadmap