Search code examples
linqsql-server-2008ado.netskip-take

Does LINQ skip & take have decent performance?


We have a query for about 40 data fields related to customers. The query will often return a large amount of records, say up to 20,000. We only want to use say around the first 500 results. Then, we just want to be able to page through them 10 at a time.

Is LINQ skip and take a reasonable approach for this? Are there any potentnialy performance issues with using this approach vs doing it manually some other way?


Solution

  • Take() without Skip() generates SQL using TOP clause.

    Take() with Skip generates SQL using ROW_NUMBER() as shown here.

    Also, I'd recommend to use excellent LINQPad tool or LINQ to SQL logging to check generated queries.