7👍
Detailed discussion in bug report: https://code.djangoproject.com/ticket/24082
Triage: Accepted to skip index when db_index=False
(with unique=True
)
26👍
The heart of the issue is this guarantee made in the Django documentation:
Note that when
unique
isTrue
you don’t need to specifydb_index
, becauseunique
implies the creation of an index.
So by Django’s contract, unique=True
implies db_index=True
, and db_index=True
means that Django has to create the text_pattern_ops
index to support all lookup types (see ticket 12234).
As for just using a single unique index, the PostgreSQL documentation says that that won’t cover all lookup types:
Note that you should also create an index with the default operator class if you want queries involving ordinary <, <=, >, or >= comparisons to use an index. Such queries cannot use the xxx_pattern_ops operator classes.
You can try adding both unique=True
and db_index=False
.
- Libmysqlclient.18.dylib image not found when using MySQL from Django on OS X
- Saving authentication token in cookie (Django Rest Framework + React)
- A good collaborative filtering/matching/recommendation library for Python/Django?
- Django – (OperationalError) FATAL: Ident authentication failed for user "username"
- Yuglify compressor can't find binary from package installed through npm