← PostgreSQL learning pathPostgreSQL · Module 8 of 10
Advanced features: JSONB, views, functions
Use Postgres's powerful built-in features.
📖 Key ideas
- JSONB stores JSON with operators: data->>'name', data @> '{"a":1}'.
- Views save queries; materialized views store results.
- Functions in SQL or PL/pgSQL; triggers run on changes.
- CTEs (WITH) make complex queries readable; recursive CTEs walk trees.
- 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