How to improved query performance in Django admin search on related fields (MySQL)

后端 未结 2 1185
情深已故
情深已故 2021-01-13 14:34

In Django I have this:

models.py

class Book(models.Model):
    isbn = models.CharField(max_length=16, db_index=True)
    title = mod         


        
2条回答
  •  花落未央
    2021-01-13 15:04

    You can redefine get_changelist for ModelAdmin subclass and try to optimize query manually there. For example, ISBN can be looked up with exact match instead of icontains, and you can add subqueries on Book to work faster.

提交回复
热议问题