A simple collection.length call in webdsl causes the whole collection to be fetched from the db. If the items within the collection are not needed, this may become very expensive for large collections.

In the current query optimization branch a wrapper around collections (a persistent collection class) is generated for each collection role. We can extend these classes (or its abstract class) to override the size() method. If collection is not fetched yet -> execute a count query, otherwise call collection.size().

Submitted by Elmer van Chastelet on 31 May 2012 at 11:16

Log in to post comments