Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 168119
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T12:23:48+00:00 2026-05-11T12:23:48+00:00

Should I use LINQ’s Skip() and Take() method for paging, or implement my own

  • 0

Should I use LINQ’s Skip() and Take() method for paging, or implement my own paging with a SQL query?

Which is most efficient? Why would I choose one over the other?

I’m using SQL Server 2008, ASP.NET MVC and LINQ.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T12:23:49+00:00Added an answer on May 11, 2026 at 12:23 pm

    Trying to give you a brief answer to your doubt, if you execute the skip(n).take(m) methods on linq (with SQL 2005 / 2008 as database server) your query will be using the Select ROW_NUMBER() Over ... statement, with is somehow direct paging in the SQL engine.

    Giving you an example, I have a db table called mtcity and I wrote the following query (work as well with linq to entities):

    using (DataClasses1DataContext c = new DataClasses1DataContext()) {     var query = (from MtCity2 c1 in c.MtCity2s                 select c1).Skip(3).Take(3);     //Doing something with the query. } 

    The resulting query will be:

    SELECT [t1].[CodCity],      [t1].[CodCountry],      [t1].[CodRegion],      [t1].[Name],       [t1].[Code] FROM (     SELECT ROW_NUMBER() OVER (         ORDER BY [t0].[CodCity],          [t0].[CodCountry],          [t0].[CodRegion],          [t0].[Name],         [t0].[Code]) AS [ROW_NUMBER],          [t0].[CodCity],          [t0].[CodCountry],          [t0].[CodRegion],          [t0].[Name],         [t0].[Code]     FROM [dbo].[MtCity] AS [t0]     ) AS [t1] WHERE [t1].[ROW_NUMBER] BETWEEN @p0 + 1 AND @p0 + @p1 ORDER BY [t1].[ROW_NUMBER] 

    Which is a windowed data access (pretty cool, btw cuz will be returning data since the very begining and will access the table as long as the conditions are met). This will be very similar to:

    With CityEntities As  (     Select ROW_NUMBER() Over (Order By CodCity) As Row,         CodCity //here is only accessed by the Index as CodCity is the primary     From dbo.mtcity ) Select [t0].[CodCity],          [t0].[CodCountry],          [t0].[CodRegion],          [t0].[Name],         [t0].[Code] From CityEntities c Inner Join dbo.MtCity t0 on c.CodCity = t0.CodCity Where c.Row Between @p0 + 1 AND @p0 + @p1 Order By c.Row Asc 

    With the exception that, this second query will be executed faster than the linq result because it will be using exclusively the index to create the data access window; this means, if you need some filtering, the filtering should be (or must be) in the Entity listing (where the row is created) and some indexes should be created as well to keep up the good performance.

    Now, whats better?

    If you have pretty much solid workflow in your logic, implementing the proper SQL way will be complicated. In that case LINQ will be the solution.

    If you can lower that part of the logic directly to SQL (in a stored procedure), it will be even better because you can implement the second query I showed you (using indexes) and allow SQL to generate and store the Execution Plan of the query (improving performance).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In which situations I should use LINQ to Objects? Obviously I can do everything
I use LINQ to Objects instructions on an ordered array. Which operations shouldn't I
We use LINQ to Entities to write entries into an Audit database (SQL Server
I want to use linq to sort a resultset. The resultset should contain all
I recently started to use LINQ to SQL and i have a minor complex
we have designed a multi threaded server that use linq to sql at each
I am just starting to use linq to sql for data access. It is
I used LINQ to SQL to generate a dbml file which contains the database
MSDN says that you should use structs when you need lightweight objects. Are there
What GUI should use to run my JUnit tests, and how exactly do I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.