Django Model Fields Indexing

Viewed 54833

I only know that indexing is helpful and it queries faster.

What is the difference between following two?

1.

class Meta:
       indexes = [
           models.Index(fields=['last_name', 'first_name',]),
           models.Index(fields=['-date_of_birth',]),
]

2.

class Meta:
       indexes = [
            models.Index(fields=['first_name',]),
            models.Index(fields=['last_name',]),
            models.Index(fields=['-date_of_birth',]),
]
2 Answers
Related