Django ORM: Retrieving posts and latest comments without performing N+1 queries
问题 I have a very standard, basic social application -- with status updates (i.e., posts), and multiple comments per post. Given the following simplified models, is it possible, using Django's ORM, to efficiently retrieve all posts and the latest two comments associated with each post, without performing N+1 queries? (That is, without performing a separate query to get the latest comments for each post on the page.) class Post(models.Model): title = models.CharField(max_length=255) text = models