none
efficient count RRS feed

  • Question

  •  

    Hi,

     

    In Linq, Is Table.Count() efficient?

     

    I couldnt quite figure out if it does a rowcount or actually pull out all the rows then perform a count on the result set.

     

     

    Cheers,

     

    Shaun

    Wednesday, September 24, 2008 1:37 PM

Answers

  • Yes it is efficient, it would generate SELECT COUNT(*) FROM Table

     

    You can always check what LINQ to SQL is generating by watching the log, e.g. myDatacontext.Log = Console.Out

     

    Wednesday, September 24, 2008 1:55 PM
    Answerer

All replies

  • Yes it is efficient, it would generate SELECT COUNT(*) FROM Table

     

    You can always check what LINQ to SQL is generating by watching the log, e.g. myDatacontext.Log = Console.Out

     

    Wednesday, September 24, 2008 1:55 PM
    Answerer
  • thanks Big Smile

     

    Wednesday, September 24, 2008 2:53 PM