Performance of switch in ASP.Net vs. decision structure in SQL
Maximizing system performance, I generally prefer to employ all possible processing on db instead of web server.
The C# code employs a 10-case switch to discern which sproc to call, and am wondering if a decision structure in a single sproc will offer a substantial performance increase (i.e. is the performance cost on the db "significantly" less than the performance cost on the web server).
A switch() in C# code *HAS* to be faster than whatever you would replace it with in SQL.
A C# switch( ) will execute in a couple of nanoseconds. You'd be amazed at how efficient a compiler can make a switch be. Especially if the switch values are contiguous integers. But it's pretty darned fast no matter what.
Bookmarks