If you have come to Django with a fairly good MySQL, PostgreSQL background this will be obvious. If your experience of databases is creating a Django model, this may be of use to you.
class Blog(models.Model): title = models.CharField(max_length=100) added = models.DateTimeField(auto_now_add=True) body = models.TextField()
Well now lets assume you have 2000 entries in your database and you decied you want to list your items in order they were added, or by title. Databases are great, but without indexes it needs to scan over 2000 rows to figure out the order.
class Blog(models.Model): title = models.CharField(db_index=True, max_length=100) added = models.DateTimeField(db_index=True, auto_now_add=True) body = models.TextField()
Well, now there are indexes, your database server just needs to take a look over the list of indexes. Its a lot faster.
A good rule, if you are going to order by, or filter by, it should be indexed.