473,811 Members | 3,485 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4074
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.co mschreef in bericht
news:uQ******** ******@TK2MSFTN GP05.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**********@g mail.comschreef in bericht
news:32******** *************** ***********@c65 g2000hsa.google groups.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
1516
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 primary experience is developing applications using VB or DotNet. I have some sql skills but they are limited. In a previous company our concept on SQL was that it was used for very simple work, (i.e. insert, update, delete, select, etc). The...
1
1263
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 there a way to convert my existing SQL Stored Procedures to LINQ code?
7
3029
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 proper tier to put it since is a data function But then I've heard that writing SQL in my client .NET code might run just as fast? Dynamic SQL or something? And then there's LINQ on the horizon. Is it a successor to everything
1
1605
by: hareen | last post by:
In LINQ stored procedures are Fast or LINQ Queries have Fast Access to Data Base
8
2635
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 efficient, what use is LINQ to SQL, other than to have a simpler way to call my stored proc?
3
2800
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 architecture than a "legacy" 3-tier? Another question, concerning binding: Would LINQ be used in addition to binding, instead of binding, or coexist within an application? Not inferring any bias with the above, just curious...
6
1556
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 that my connection provider is unsupported. Then I found out that LINQ to SQL officially supports only .NET Provider for SQL Server. The problem is that SQL Server 7 can't work with this provider, so I have to use the .NET Provider for OLE DB. Well,...
9
2265
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 Framework. Though I am quite comfortable with ADO.NET and VB.NET. In your opinion, should I take a few days and learn it and utilize these technologies in this new project (I'm starting from scratch)? Are the benefits worth it in your opinion?...
4
2537
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. 1. It speeds up development. Yes or No? 2. It makes programs easier to code and read. Yes or No? 3. Perfomance is the same (or comparable) comparing Linq with MsSql and ADO.NET
0
9730
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9605
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10403
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10136
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9208
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7671
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6893
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4341
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3020
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.