Running the same .Net code in SQLCLR is much slower than running in Web Service RRS feed

  • 問題

  • I have a web service which do some calculations, and we want to do the calculation via the SQL query. Hence, we had implemented an UDF using SQL Server Project to call the web service. Like this:

    select a, b, calc(a,b) from table1

    which calc() is an UDF which pass a and b to the web service to do the calculation.

    Since the UDF calls the web service by each of the rows, it is not efficient that web service is running on HTTP. We try to migrate all the .Net code in web service to SQL Server project that do the calculation directly within SQLCLR.

    However, the outcome is that it runs much slower than web service. By running the same query, it is around 6 times slower than web service. It seems not logical. Are there any limitations in SQLCLR which made the same piece of code running slower than web service?

    Thank you.
    2010年2月4日 上午 03:20


  • I think that this is hard to judge, and hard to prove it. I would like to ask, are they doing the same coding in .NET CLR and SQL CLR?

    Beside that, all i can find is, a comparision between T-SQL and SQL CLR.

    大家一齊探討、學習和研究,謝謝! Microsoft MVP, Microsoft Community Star(TW & HK), MCT, MCSD, MCAD, MCSE+I, MCDBA, MCDST, MCSA, MCTS, MCITP
    2010年3月30日 上午 04:21
  • Sure the same code. Otherwise, it is not compariable. It is really strange why SQL CLR runs much slower than .NET CLR. Can I have any fine tuning on SQL CLR?
    2010年5月28日 上午 09:03