I've recently come across this idea that separation of data manipulation logic fully in the SQL code would result in a performance gain, but I'm unsure to what extent this is true and for that reason I'm posting this question.
Assuming that we have a database (let's say a small gallery) in which we have galleries, photos, and tags. Each photo can be member of many galleries, and each photo or gallery can have many tags. I create a single stored procedure for handling photo and gallery management (i.e. PhotoCreateOrUpdate) that can accepts an array of galleries (in serialized text, i.e. GalleryA:Info:Tag1|Tag2), photo information, the same for photo tags, and an array for galleries or tags to be deleted when updating the record. If gallery exists, relations will be added, else they will be created, and same for tags and other things.
I've decided to do this instead of relying on Entity Framework because I believe that this way I can send only one request to the database from the Web-End and this can result a performance gain as I avoid a lot of foreach loops and certain joins can be done faster.
However, when deserialzing the formatted texts, I have to use Cursors a few times which would be equal to the loops when using Entity Framework.
I also think that another advantage of this approach would be to segregate concerns into their own context and keep the ASP.Net code clean.
I want to know to what extent my assumptions are true and this is the point of the question.