Even if your collections are small, the SQL generated by the code generator will never be as optimized as manual-encoded SQL, especially if getting a good execution plan is highly dependent on choosing the right indexes.
Assuming that you manually code these cases and use SP, in cases where the data is very large, you will need many tricks to use memory efficiently, regardless of whether your database engine can help you or not.
But every abstraction has limits.
source
share