clean-architecture-manga icon indicating copy to clipboard operation
clean-architecture-manga copied to clipboard

Repositories and Performance

Open oleg-varlamov opened this issue 4 years ago • 0 comments

Hello! Thank you for the perfect DDD-example!

I am a fan of DDD and in my projects, I try to adhere to this approach. But there is one problem for which I cannot come up with a beautiful solution. And your code has this problem too.

The moment concerns the implementation of the AccountRepository and the Account aggregate - you load all transactions for the account into memory. If there are few transactions, then this is not a problem. However, if the number of transactions is huge (for example 1,000,000), then this will lead to a significant decrease in performance (and possibly degradation of the database).

What approach do you think will help avoid such problems and allow you to stay within the DDD?

oleg-varlamov avatar Jan 15 '21 07:01 oleg-varlamov