Answered LINQ String Slower than LINQ Int?

  • Friday, November 16, 2012 10:22 AM
     
      Has Code

    I have a simple join that works, and at the end I have either:

    where string == string 

    this takes about 2 minutes on a database with 44 million records.

    If I however search on the int column

    where int == int

    the query takes seconds? On the same db with the same number of records?

    Are there any reasons for this?

All Replies

  • Friday, November 16, 2012 5:14 PM
     
     

    One of the fields could be indexed and the other not.

    LS


    Lloyd Sheen

  • Saturday, November 17, 2012 1:48 PM
     
     Answered
    Basically it's not about LINQ cause, your where condition is finally translated into SQL Statement and operation is performed in SQL and of course,  search by varchar will be slower than int.

    Please mark as reply if helped.
    Also visit my blog http://msguy.net/