Slow Query RRS feed

  • Question

  • Hi,
    After writing a linq query, and executing it, the time taken to execute is extremely long, too long for a user to sit and wait for, when I execute the SQL that the Linq query has generated directly into my SQL Management Studio Window it takes 7 seconds. Why is this the case? The tables Im joining are pretty big. If I dont set the timeout I get an SqlException on this line:

    dbBindSource.DataSource = queryLinq;

    All the tables Im joining are mapped to entities, could the fact that Im mapping the entities tables with large amounts of data be the problem? Is there anything to look out for when writing Linq queries or a general guide on how to make them optimised?


    Thursday, February 19, 2009 6:29 PM

All replies

  • Are you taking the generated SQL output directly from the log ?

    To dig down we'd really need to know a bit more about what kind of structure/database/dbml you are dealing with such as whether the tables contain binaries or very large text fields, how much modification has been done to the entities in the partial classes etc.

    Tuesday, March 3, 2009 7:37 PM