JSONB Queries, Window Functions & GIN Indexes
Lesson Overview: Query nested JSONB fields with ->> and rank rows with ROW_NUMBER() OVER().
Analytic Window Functions
Window functions calculate running totals or rankings across partitions WITHOUT collapsing individual rows like GROUP BY does.
- col->>'key' extracts a JSONB field as text
- CREATE INDEX USING GIN speeds up JSONB containment queries
Test Yourself With Exercises
Extract a JSONB property as plain text in PostgreSQL using operator:
data
'title'