【发布时间】:2016-03-07 12:16:29
【问题描述】:
class PortalContent(models.Model):
movies = models.ForeignKey(Movie, db_column="movies_id")
portalID = models.IntegerField()
projectID = models.IntegerField(default=0)
contentType = models.CharField(max_length=100)
licenseTerms = models.TextField()
createDate = models.DateTimeField(auto_now=True)
我有上面的模型。这个模型有一个通过外键与电影模型相关的字段。
Now when I view the list /portalContent/1/
数据加载时间超过 2 秒。电影表只有 20K 条记录。 不知道为什么这需要这么多时间。我使用了 debug_toolbar 并显示了一个查询,即 select * from movies 占用 1.6s 。这两个表都定义了索引。
谁能指导我
【问题讨论】:
-
您使用的是可浏览的管理界面吗?如果你是... stackoverflow.com/questions/22173425/…