473,395 Members | 2,006 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Discussion: linq vs stored procedures

Hi,

My experience with linq is that I can develop my web application very fast.
On the other hand, I have read that using stored procedures are executing
faster.

Is it smart to use linq for a heavily used web application, let's say for a
social network application?
Or is the performance difference between linq and stored procedures to
small? And what about the future differences, will linq technology be faster
in the future?

Thanks you.

Aug 22 '08 #1
6 4062
Arjen wrote:
Hi,

My experience with linq is that I can develop my web application very
fast. On the other hand, I have read that using stored procedures are
executing faster.

Is it smart to use linq for a heavily used web application, let's say
for a social network application?
Or is the performance difference between linq and stored procedures to
small? And what about the future differences, will linq technology be
faster in the future?

Thanks you.
The advantage of stored procedures is that you are sure that the query
always looks the same, so the database will cache the execution plan and
the result.

Also, it's a bit easier to optimise the query, as you can easily run the
stored procecdure and see the execution plan. It's harder to predict
what the query generated by LINQ will look like, and how to change the
code to get it to generate the desired query.

--
Göran Andersson
_____
http://www.guffa.com
Aug 22 '08 #2
Not an easy one; in addition to Göran's points, you also have a little
more control (re security) with SPs, but I like LINQ / ORM ;-p (I used
to be an SP junkie...). You also get the benefits of composabiltiy
with LINQ, which can be very welcome - but means you can't guarantee
what your final queries look like. Double edged.

Marc
Aug 23 '08 #3

"Göran Andersson" <gu***@guffa.comschreef in bericht
news:uQ**************@TK2MSFTNGP05.phx.gbl...
Arjen wrote:
>Hi,

My experience with linq is that I can develop my web application very
fast. On the other hand, I have read that using stored procedures are
executing faster.

Is it smart to use linq for a heavily used web application, let's say for
a social network application?
Or is the performance difference between linq and stored procedures to
small? And what about the future differences, will linq technology be
faster in the future?

Thanks you.

The advantage of stored procedures is that you are sure that the query
always looks the same, so the database will cache the execution plan and
the result.

Also, it's a bit easier to optimise the query, as you can easily run the
stored procecdure and see the execution plan. It's harder to predict what
the query generated by LINQ will look like, and how to change the code to
get it to generate the desired query.

--
Göran Andersson
_____
http://www.guffa.com

Hi Göran, hi Marc,

What about a combination?
For select statements stored procedures and for create, update, and delete
statements linq?

What is your opinion?

Thanks again!

Arjen

Aug 23 '08 #4
Arjen wrote:
Hi,

My experience with linq is that I can develop my web application very
fast. On the other hand, I have read that using stored procedures are
executing faster.
sp's aren't executed faster. Both (dynamic queries with parameters and
procs) are compiled to an execution plan, and that execution plan is ran
and also cached. So the second time you call the same proc, or run the
same dyn. query, the db will check it's cache and will re-use the
execution plan. If the execution plan is still valid, it will run it
again, if not (statistics changed etc.) it will recompile the query, be
it a proc or a dyn. query.

So there's no difference in execution speed. Anyone telling you that is
either believing the myth or lying.

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#)
------------------------------------------------------------------------
Aug 24 '08 #5
Anyone telling you that is either believing the myth or lying.

Or just believing the old truth; "back in the day" there were more
significant performance benefits in stored procedures, but things are
a lot more even these days. I say this just for the OPs benefit (I'm
fairly certain Frans could easily trump me on database knowledge...).

Marc
Aug 24 '08 #6

"Marc Gravell" <ma**********@gmail.comschreef in bericht
news:32**********************************@c65g2000 hsa.googlegroups.com...
>Anyone telling you that is either believing the myth or lying.

Or just believing the old truth; "back in the day" there were more
significant performance benefits in stored procedures, but things are
a lot more even these days. I say this just for the OPs benefit (I'm
fairly certain Frans could easily trump me on database knowledge...).

Marc

Okay, thank you both.

Arjen

Aug 25 '08 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Doug | last post by:
Hi, I wanted to start a general discussion more for getting some thoughts on what other people think/practice out there just to see how far (if at all) I'm off base on my own thoughts. My...
1
by: shapper | last post by:
Hello, I have been reading a few articles about LINQ and I have a few questions: 1. What do I need to start using it in my ASP.NET 2.0 / SQL 2005 / Visual Studio 2005 web sites? 2. Is...
7
by: Ronald S. Cook | last post by:
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 - is the more...
1
by: hareen | last post by:
In LINQ stored procedures are Fast or LINQ Queries have Fast Access to Data Base
8
by: Frank Calahan | last post by:
I've been looking at LINQ and it seems very nice to be able to make queries in code, but I use stored procs for efficiency. If LINQ to SQL only works with SQL Server and stored procs are more...
3
by: Dean Slindee | last post by:
I'm confused. After all these years of promoting 3-tier architecture, isn't LINQ moving us back to a 2-tier architecture (no stored procedures?). Are there scenarios where LINQ would be a better...
6
by: Dmitry Perets | last post by:
Hello, I am trying to work with MS SQL Server 7 from the release version of Visual Studio 2008 + LINQ to SQL. And the problem is that the LINQ to SQL designer doesn't accept my tables saying...
9
by: Cirene | last post by:
I'm about to begin a brand new, big, ASP.NET project (using 3.5 .net fw), VS 2008. I'm using MySQL as the backend (customer request.) I have absolutely no experience with LINQ and/or the Entity...
4
by: George | last post by:
I am a bit conservative type and usually give some time for technology to mature before starting to try it. Today my question is Linq. To start using it or not. So here is the voting questions....
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.