Hacker News new | past | comments | ask | show | jobs | submit login

Damn, those are new ? Or did just the formating change?



The old index syntax (e.g. unique=True) will still work, and is now considered a shortcut for the more verbose syntax. The idea is to have one standard syntax that supports creating non-btree indexes in the model definitions, rather than needing to create them via custom migrations.


Bit of both.

Previously, you could indicate you wanted an index on a field, but only on a single field, and you did it in the field definition.

Declaring them in Meta via the Index class is new, as is the multi-field support and direction support. More importantly, you can subclass Index to define other types of indices besides the default (which is btree). For example, Django now ships built-in subclasses to do BRIN and GIN on Postgres.


Is there anywhere django docs on how to actually use the brin/gin indexes? All I can find is that they exist...



single field?

what about `unique_together` and `index_together`?


You previously couldn't define the name or type of an index. You just listed tuples of fields to be indexed.


Class-based db indexes are new.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: