1
是否有這些查詢之間的區別:Django。與延遲get_or_create優化
category, _ = models.Category.objects.get_or_create(
title=some_title,
brick=node_id,
parent=parent,
)
和:
category, _ = models.Category.objects.defer('data').get_or_create(
title=some_title,
brick=node_id,
parent=parent,
)
?
凡的分類模型是這樣的:
class Category(Model):
title = models.CharField(max_length=255, blank=True, null=True)
brick = models.IntegerField(
primary_key=True,
)
parent = models.ForeignKey('self', blank=True, null=True)
data = models.TextField(blank=True, null=True) # very large text