Question is: does Django AutoField create db_index on itself? (In docs I didn't find anything about that)
If not, how to do that?
Thanks!
Question is: does Django AutoField create db_index on itself? (In docs I didn't find anything about that)
If not, how to do that?
Thanks!
An AutoField must have primary_key=True. A primary key is a unique index.
id = models.AutoField(primary_key=True) (docs.djangoproject.com/en/dev/topics/db/models/…) however in postgres id fields do not appear to be indexed.
python manage.py sqlindexes __your_app__to check the indexes thatsyncdbwill create.idfield.