From: RG on 22 Mar 2010 18:38 Performancewise, is there a difference between your cursor loop/update stored procedure and c# program, residing where sql server is, that does the same? Thanks in advance
From: Erland Sommarskog on 22 Mar 2010 18:44 RG (RG(a)discussions.microsoft.com) writes: > Performancewise, is there a difference between your cursor loop/update > stored procedure and c# program, residing where sql server is, that does > the same? Not sure exactly what you have in mind, but I suppose the answer is "it depends". Even if the C# program run on the SQL Server machine, there may be a lot of data that will be passed between different processing. On the other hand, if there is complex processing done to each row, this is likely to run faster in C#. Yet an alternative is to do the processing in a stored procedure written in C#. That is the same thing as the application, but inside SQL Server. Again, whther this is a good idea or not, depends. -- Erland Sommarskog, SQL Server MVP, esquel(a)sommarskog.se Links for SQL Server Books Online: SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx SQL 2000: http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
From: Plamen Ratchev on 22 Mar 2010 18:46 Most likely a C# program will incur more traffic if it has round trips/connections to iterate over data (even if the client application resides on the same physical machine) and be slower than server side stored procedure. The power of SQL is not iteration but set based solutions and you may be able to write a very efficient SQL query to accomplish your goal. -- Plamen Ratchev http://www.SQLStudio.com
From: RG on 22 Mar 2010 22:05 What if it is a wcf c# application which is multithreaded compared to many requests to execute a stored procedure. Would stored procedure still be a better choice? "Plamen Ratchev" <Plamen(a)SQLStudio.com> wrote in message news:JfmdnSfM1qrEbjrWnZ2dnUVZ_uIAAAAA(a)speakeasy.net... > Most likely a C# program will incur more traffic if it has round > trips/connections to iterate over data (even if the client application > resides on the same physical machine) and be slower than server side > stored procedure. > > The power of SQL is not iteration but set based solutions and you may be > able to write a very efficient SQL query to accomplish your goal. > > -- > Plamen Ratchev > http://www.SQLStudio.com
From: RG on 22 Mar 2010 22:06 Stored Procedures written in c#, is that in sql 2005 or 2008? "Erland Sommarskog" <esquel(a)sommarskog.se> wrote in message news:Xns9D43F1749F720Yazorman(a)127.0.0.1... > RG (RG(a)discussions.microsoft.com) writes: >> Performancewise, is there a difference between your cursor loop/update >> stored procedure and c# program, residing where sql server is, that does >> the same? > > Not sure exactly what you have in mind, but I suppose the answer is > "it depends". > > Even if the C# program run on the SQL Server machine, there may be a lot > of data that will be passed between different processing. On the other > hand, if there is complex processing done to each row, this is likely to > run faster in C#. > > Yet an alternative is to do the processing in a stored procedure written > in C#. That is the same thing as the application, but inside SQL Server. > Again, whther this is a good idea or not, depends. > > > -- > Erland Sommarskog, SQL Server MVP, esquel(a)sommarskog.se > > Links for SQL Server Books Online: > SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx > SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx > SQL 2000: > http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx >
|
Next
|
Last
Pages: 1 2 3 Prev: Function or insert/into temp table Next: what is the boot record of the database file? & TDE |