Re: Confused about proc vs. dynamic SQL vs LINQ
- From: Andy <andyj@xxxxxxxxxxxxxxxxxx>
- Date: 1 May 2007 06:56:32 -0700
On Apr 30, 4:55 pm, "Nicholas Paldino [.NET/C# MVP]"
<m...@xxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
Generally speaking, stored procedures are going to be faster than
dynamic sql. In the case of SQL Server, you might get just as fast
performance from dynamic sql (sql that you generate on the client and issue
to the server, as opposed to executing the stored procedure with parameters)
depending on the cache (dynamic queries are cached to a degree, and whether
or not they are reused depends on how often the cache is hit, as well as if
the queries are the same and a number of other factors). With stored
procedures, the execution plan is already compiled, and the server won't
have to recompile it. Depending on the statistics that were in place when
the stored procedure was compiled, and the statistics that are in place when
you execute your dynamic sql, you might get a different execution plan
(assuming you are executing the same sql dynamically that you are executing
in the stored procedure.
As of Sql Server 7, that's not true. Sql Server doesn't 'compile'
stored procedures at all. It just checks syntax. Either method you
use will cause sql to create an execution plan and cache it. After
that, it will used the cached plan either way. Check the BOL.
.
- Prev by Date: Re: Turn on/off Bluetooth, WiFi and an RFID tag reader.
- Next by Date: SQL Express User/ Role database to SQL Server
- Previous by thread: Re: Confused about proc vs. dynamic SQL vs LINQ
- Next by thread: How to drag a picturebox inside a panel control?
- Index(es):
Relevant Pages
|