Re: Confused about proc vs. dynamic SQL vs LINQ
- From: "Frans Bouma [C# MVP]" <perseus.usenetNOSPAM@xxxxxxxxx>
- Date: Tue, 01 May 2007 01:22:12 -0700
Ronald S. Cook wrote:
I've always been taught that stored procedures are better than
writing SQL in client code for a number of reasons:
- runs faster as is compiled and lives on the database server
Modern RDBMSs don't compile stored procs anymore, they evaluate any
query at runtime to execution plans which are optimized at runtime, not
at compile time. So, no, stored procedures aren't faster and no they're
not stored in compiled form.
- is the more proper tier to put it since is a data function
I think opinions differ on that ;)
But then I've heard that writing SQL in my client .NET code might run
just as fast? Dynamic SQL or something?
parameterized queries are as fast as procs and can be faster as you
can tailor dyn. SQL (parameterized!) to the job you have to do, so if
you have a table with 10 fields, you don't have to write a single
UPDATE proc which accepts values for all fields to update, you can
write an update query which updates just 1 field.
And then there's LINQ on the horizon. Is it a successor to
everything previously mentioned?
Linq is a language construct and the result of linq expressions,
expression trees, can be used to generate dyn. SQL at runtime, like any
other O/R mapper does these days.
FB
--
------------------------------------------------------------------------
Lead developer of LLBLGen Pro, the productive O/R mapper for .NET
LLBLGen Pro website: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------
.
- Prev by Date: Re: Drop event on a picture box
- Next by Date: How to emulate missing property in object
- Previous by thread: Re: Confused about proc vs. dynamic SQL vs LINQ
- Next by thread: Re: Confused about proc vs. dynamic SQL vs LINQ
- Index(es):
Relevant Pages
|