472,976 Members | 1,438 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,976 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 1543
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...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.