Not that the current setup of a single stored procedure that does 3 thing takes too long. But perhaps in the interest of speeding up when the user can see some amount of information would be useful.
I have a single stored procedure that is being run with the async/await
pattern and returns 3 separate sets of data. None of them require any of the other 2, so order and who completes first is a non-issue. Thus, the user will not see anything on the web page until the entire SP has run and is returned.
Aside from more code, which is no preferable, would it make more sense to break that SP into 3 separate SPs and have 3 separate async
calls to those SPs?
On a side note, would having still a single SP but with a new @Which
parameter make sense? Meaning when @Which = 1
query this data, when @Which = 2
query that data and so on. Or would there be some sort of lag attempting to run the same SP multiple times via 3 separate async
calls?
I have done some research - Why should I prefer single 'await Task.WhenAll' over multiple awaits? was good information, but not really for my question.