Understanding Why Aggegrate Functions Are Appropriate Only to Small Numbers of Child Rows

The aggregate functions described in this section compute their result by retrieving the rows of a child collection from the database and iterating through all of these rows in memory.

This has two important consequences:
  • These aggregate functions should only be used when you know the number of rows in the child collection will be reasonably small.
  • Your calculation may encounter a runtime error related to exceeding a fetch limit if the child collection's query retrieves more than 500 rows.