PostgreSQL Generated Columns by Example
summary
PostgreSQL 18 makes generated columns virtual by default, letting reads compute values on demand while older stored columns persist results; benchmarks shown use Django models and local timings and report orders-of-magnitude faster reads for common cases. Examples include JSON version extraction, full‑text search vectors (workaround for immutability via Case/When), GeoDjango/PostGIS area and length calculations, and simple numeric or concatenation fields. Implementation uses Django’s GeneratedField in Django 5.0 and relies on the DB — no triggers, no Python — and generally reduces storage at the cost of read CPU.
AI-written summary · about
chapters (12)
- 0:00Music & introduction
- 0:25What generated columns really are
- 1:33Speaker background & Django context
- 3:14Why compute logic in the database
- 5:00From idea to Django 5.0 feature
- 7:02Generatedfield internals explained
- 8:30Circle demo: auto-calculating area
- 10:51Item & order examples: totals and status
- 14:34JSON fields, performance, and benchmarks
- 19:00Advanced use cases: search, GIS & beyond
- 22:10GeoDjango, spatial fields, and real-world use
- 25:00Key benefits and final takeaways
related talks
35mDjango's GeneratedField
23mDjango with PostgreSQL superpowers
22mDjango with PostgreSQL superpowers
46mPostgreSQL Beyond Django: Strategies to Get Max Performance with Álvaro Justen
21mDjango and PostgreSQL: An Even-Closer Union
44mPostgreSQL in Django 1.8
46mUse PostgreSQL to Step Up Your Game
18mUnleash the power of Generated/Virtual Columns in MySQL
