Django and PostgreSQL: An Even-Closer Union
summary
Django 1.8 and 1.9 expose PostgreSQL primitives so models can store and query array field and range field types, hstore and JSONB blobs, and use expression indexes and raw SQL migrations. Examples include adding a GIN index for contains/overlaps, a GIST index for ranges, and an exclusion constraint that prevents overlapping room bookings and raises an IntegrityError when violated. Full text search uses tsvector with indexes and optional trigger maintenance. Slides and code samples accompany each feature.
AI-written summary · about
chapters (22)
- 0:00Intro
- 1:35PostgreSQL Arrays != Python Lists
- 3:13Array Field Transforms: Index
- 3:50Array Field Transforms: Slices
- 5:42Indexing Array Fields.
- 7:25Why use Array Fields!
- 8:27To infinity and beyond!
- 8:59Types of Ranges.
- 9:45A Hard Problem.
- 10:22Constraint Exclusion.
- 10:53One Catch.
- 11:11btree gist to the rescue!
- 12:29And profit!
- 13:09Why use range fields?
- 13:29JSON Fields.
- 13:48JSON Field Queries.
- 14:54Why use json instead of jsonb?
- 15:48Indexing JSON.
- 16:29Why use JSON?
- 17:45Full-Text Search!
- 18:47Full-Text Configurations
- 19:59Fancy Indexing.
related talks
44mPostgreSQL in Django 1.8
22mDjango with PostgreSQL superpowers
23mDjango with PostgreSQL superpowers
46mPostgreSQL Beyond Django: Strategies to Get Max Performance with Álvaro Justen
27mDjango - Customise your SQL
46mUse PostgreSQL to Step Up Your Game
26mPostgreSQL Generated Columns by Example
29mPostgres Demystified
