What is the difference between annotate() and aggregate() in the Django ORM?

Last updated 17 June 2026

  • aggregate() computes one summary value over the whole queryset and returns a dict (terminal, ends the queryset).

  • annotate() attaches a computed value to each object and returns a queryset you can keep filtering or ordering.

  • Combining annotate() with values() produces GROUP BY aggregates per group.

  • https://www.geeksforgeeks.org/python/aggregate-vs-annotate-in-django/
All Django interview questions