← PostgreSQL learning path
PostgreSQL · Module 8 of 10

Advanced features: JSONB, views, functions

Use Postgres's powerful built-in features.

📖 Key ideas

  1. JSONB stores JSON with operators: data->>'name', data @> '{"a":1}'.
  2. Views save queries; materialized views store results.
  3. Functions in SQL or PL/pgSQL; triggers run on changes.
  4. CTEs (WITH) make complex queries readable; recursive CTEs walk trees.
  5. Full-text search with tsvector and tsquery.
💡 Real-life example: A view is a saved window: look through it anytime and see the latest data in that frame.
JSONBBinary JSON column type
Materialized viewStored query results
TriggerFunction run on data change
CTENamed sub-query with WITH