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

  • Home
  • SEARCH
  • 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

Ask A Question

Stats

  • Questions 219k
  • Answers 219k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer If you want more extensive pattern support, take a look… May 12, 2026 at 11:50 pm
  • Editorial Team
    Editorial Team added an answer You could try logging the installation and see what you… May 12, 2026 at 11:50 pm
  • Editorial Team
    Editorial Team added an answer You want Concat: return GetThePrimaryIds().Select(id => GetColorById(id)).Concat( GetTheOtherIds().Select(id => GetOtherColorsById(id)));… May 12, 2026 at 11:50 pm

Related Questions

Should I use LINQ's Skip() and Take() method for paging, or implement my own
I'd like to use Linq to XML to output a sorted list each element
I use LINQ a lot in general, especially LINQ-to-Objects, hence I'm rather fluent in
I need to create several applications that all share a Microsoft SQL Server database.
I'm writing an app that retrieves RSS feeds on a scheduled daily basis and

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.