473,386 Members | 1,702 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,386 software developers and data experts.

Linq and performance

Hi guys
I have a one question, is Linq to Sql good in pefornace?
is better that traditional method? ismore than speed?? or is same?

Thanks..

Regards
Cesar
Jun 27 '08 #1
2 1562
That isn't a simple question...

There are obviously overheads with LINQ-to-SQL (as with any ORM): it
needs to parse expressions and translate to sql, and there are
obviously a few layers in this stack (although perhaps no more than a
standard business/DAL setup); the raw query at the database should be
*broadly* comparable.

Custom developer-written SQL might sometimes (if done well) be faster,
but equally it could be a lot worse - and consider that LINQ-to-SQL
will automatically adjust to the server (for instance, "paging" will
use CTE on SQL 2005, but a TOP / subquery / TOP on SQL 2000) - so it
might take advantage of things your own SQL doesn't.

Then we need to consider composability: with LINQ-to-SQL, if you build
a query, then add additional constraints ("where", etc) or other
operations ("orderby", etc) - then all of that goes down in the same
query. Likewise if you do a projection in the select (i.e. you only as
for a couple of columns) - then only those columns are SELECTed in the
SQL; this reduces network IO, and server disk IO (compared to running
a fixed query, and then ignoring various rows/columns in the results).

And then we also need to consider development effort: if it is going
to take you 10 minutes to drop a few tables onto the designer surface
and use them, compared to a day-or-so to do similar by hand, writing
lots of very, very similar code...

So I'm quite interested in LINQ-to-SQL and Entity Framework - but
really, you are going to have to do performance tests on your own
data, using realistic queries, to truly get an answer. But don't
forget - all those (small) overheads are on you app-servers, which you
easily scale "out", rather than the database server which you have to
scale "up".

I asked Mike Taulty this exact question the other day (talking about
Entity Framework). His answer was more or less the same as my own
conclusions (above).
Jun 27 '08 #2
Thank you Marc ...
Regards..
Cesar
"Marc Gravell" <ma**********@gmail.comescribió en el mensaje
news:ce**********************************@c58g2000 hsc.googlegroups.com...
That isn't a simple question...

There are obviously overheads with LINQ-to-SQL (as with any ORM): it
needs to parse expressions and translate to sql, and there are
obviously a few layers in this stack (although perhaps no more than a
standard business/DAL setup); the raw query at the database should be
*broadly* comparable.

Custom developer-written SQL might sometimes (if done well) be faster,
but equally it could be a lot worse - and consider that LINQ-to-SQL
will automatically adjust to the server (for instance, "paging" will
use CTE on SQL 2005, but a TOP / subquery / TOP on SQL 2000) - so it
might take advantage of things your own SQL doesn't.

Then we need to consider composability: with LINQ-to-SQL, if you build
a query, then add additional constraints ("where", etc) or other
operations ("orderby", etc) - then all of that goes down in the same
query. Likewise if you do a projection in the select (i.e. you only as
for a couple of columns) - then only those columns are SELECTed in the
SQL; this reduces network IO, and server disk IO (compared to running
a fixed query, and then ignoring various rows/columns in the results).

And then we also need to consider development effort: if it is going
to take you 10 minutes to drop a few tables onto the designer surface
and use them, compared to a day-or-so to do similar by hand, writing
lots of very, very similar code...

So I'm quite interested in LINQ-to-SQL and Entity Framework - but
really, you are going to have to do performance tests on your own
data, using realistic queries, to truly get an answer. But don't
forget - all those (small) overheads are on you app-servers, which you
easily scale "out", rather than the database server which you have to
scale "up".

I asked Mike Taulty this exact question the other day (talking about
Entity Framework). His answer was more or less the same as my own
conclusions (above).

Jun 27 '08 #3

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

Similar topics

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...
4
by: =?Utf-8?B?V2lsc29uIEMuSy4gTmc=?= | last post by:
Hi Experts, I am doing a prototype of providing data access (read, write & search) through Web Service. We observed that the data storing in SQL Server 2005, the memory size is always within...
2
by: SC | last post by:
Having inherited an NHibernate-based website, I'm not sold on OR/M mapping tools for largest sites - from what I've seen, even "tuned" nhiberate queries result in poor performance and I haven't...
7
by: =?Utf-8?B?Q2hha3JhdmFydGh5?= | last post by:
Today, after watching the presentation by Amanda Silver at http://channel9.msdn.com/Showpost.aspx?postid=335058 , from Channel 9, started exploring the LINQ features. Surprisingly, few facts...
22
by: paululvinius | last post by:
Hi! Testing som Linq-expressions and tried to measure performance and compare it to pre-Linq programming. The folloing two methods are functional equal but the non-Linq one is twice as fast....
0
by: John Smith | last post by:
Hello people, I have a performance query regarding LINQ that I would like some opinions. Currently we have a business logic framework that is used in n-tier applications. We read data from a...
4
by: Jacek Jurkowski | last post by:
Why is it so slow? I really like that queries but using DataReader i have done my task's much more faster than ising LINQ...
5
by: =?Utf-8?B?cmF1bGF2aQ==?= | last post by:
linq on objects... want to find if the object exist in its collection if I have a loop searching in the collection foreach (myClass r in collections) { if (r.field01 == type && r.field02...
5
by: ck1 | last post by:
Hi at all - I want to know if there are diffirence with Liqn to SQL and Linq To entity performance. I have read many article on the web that say that Linq To Entity is more fast than Linq To...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.