none
linq to sql question concerning speed of query in linq to sql vs speed of query in mangement studio RRS feed

  • Question

  • I created a query in linq to sql it is just a join and taking a long
    time to run.
    I am logging to a file using the log of the data context.
    If I take the query there and run it it returns in 17 seconds in query
    analyser.
    However when running in my app it takes half an hour.
    Anyone have any similar experiences?
    Also is the query shown in the log the one the actually gets run?
    Also I started getting the incredible performance distance when I added a join between two nullable columns.
    I have read that linq to sql may have problems with this.

    Thanks in advance

    Sincerely

    Ralph
    Wednesday, July 8, 2009 8:45 PM

Answers

  • That could be caused by a variety of issues; locking, mismatching data types [between input parameters and db columns] etc.

    If you don't mind sharing the definition of the tables involved together with your Linq query, please post it here and it will be easier to identify what might be the problem.

    Also, you may find my L2S query profiler useful for this kind of issues; it will provide more details as to what happened db-side. You can download it and get a free 45-day trial license from http://www.huagati.com/L2SProfiler/

    Kristofer - Huagati Systems Co., Ltd. - Cool tools for Linq-to-SQL and Entity Framework: www.huagati.com/dbmltools (VS designer add-in), www.huagati.com/L2SProfiler (query profiler for L2S)
    Thursday, July 9, 2009 1:08 AM
    Answerer

All replies

  • That could be caused by a variety of issues; locking, mismatching data types [between input parameters and db columns] etc.

    If you don't mind sharing the definition of the tables involved together with your Linq query, please post it here and it will be easier to identify what might be the problem.

    Also, you may find my L2S query profiler useful for this kind of issues; it will provide more details as to what happened db-side. You can download it and get a free 45-day trial license from http://www.huagati.com/L2SProfiler/

    Kristofer - Huagati Systems Co., Ltd. - Cool tools for Linq-to-SQL and Entity Framework: www.huagati.com/dbmltools (VS designer add-in), www.huagati.com/L2SProfiler (query profiler for L2S)
    Thursday, July 9, 2009 1:08 AM
    Answerer
  • Thanks to all who responded.
    Turns out that after I figured out profiler and used it properly I determined that this is indeed a sql problem and nothing to do with linq.  Again thanks for all the assitance.
    Thursday, July 9, 2009 2:43 PM