Performance of switch in ASP.Net vs. decision structure in SQL

Results 1 to 3 of 3

Thread: Performance of switch in ASP.Net vs. decision structure in SQL

  1. #1
    Join Date
    Dec 1969
    Posts
    853

    Question 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).

    Any thoughts?

  2. #2
    Join Date
    Dec 1969
    Posts
    96,021

    Default

    Nope. I think you have it right.

    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.

  3. #3
    Join Date
    Dec 1969
    Posts
    853

    Default

    Thx again.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •