You should never rely on lazy loading to retrieve your object. If you do this, you will end triggering maybe 1000 selects instead of one, which may a noticeable impact on performances, as you guess.
This is known as the "n+1 syndroma", imagine you have a Client that has an account, if you don't take care of retrieving client and their accounts with a sql-join, then iterating on the clients and accessing their accounts will trigger say 1000 selects if you have 1000 clients for example (and imagine the multiplication what if you access something related to the account...). So, you should care about loading all the graph you need in the client side, and throwing a new query only when it was planned, or normal, not because of the lazy loading feature.
HTH
_________________ Baptiste
PS : please don't forget to give credits below if you found this answer useful :)
|