SQL Server Performance

Overhead for DB accesses?

Discussion in 'SQL Server 2008 Performance Tuning for DBAs' started by greggo, Jun 8, 2009.

  1. greggo New Member

    Hello everyone,I am trying to optimize an existing system which is currently using LINQ.
    I have a section where LINQ makes 4-7 database queries for different sections of data based on a primary key. Each query is obviously very fast (1-10ms on SQL Server Profiler), but I am concerned that there may be overhead in making each separate query, and am considering writing a single larger query as a stored procedure to get all the information used for the section. I am hesitant to do so as some of the logic to rewrite this will be complex.
    Could anyone suggest a way of determining what, if any, overhead is involved in making a LINQ query, so that I can better determine if rewriting this section will be helpful?
    Thanks in advance,
    Greg
    Edit:From start to finish, the set of queries takes about 100ms, but I amnot sure if that is due to overhead in making each query, or if it istime spent in other places in the code.
  2. satya Moderator

    Do you see any performance overhead for these queries?
    Or do you see any slowdown of performance when these are executed on SQL>
  3. RickNZ New Member

    There is definitely overhead for each DB query round-trip. With LINQ, there is also additional overhead to process the generated dynamic SQL.
    If you decide to rewrite the queries, one approach might be a stored procedure that just returns one result set for each of your current queries. You can also use command batching if you switch to ADO.NET.

Share This Page