Efficient Pagination with Skip/Take

Efficient pagination using OFFSET-FETCH on SQL Server.

Execution Time

70 ms

Page Size

50

Current Page

36 / 489

Total Records

24441

Items per page: 25 50 100 200

Page 36 Results Showing 1751 - 1800 of 24441

ID Name Category Price Stock Rating Reviews SKU
1979 Pro Automotive Product Mini Automotive $144.65 37 2.5 562 SKU-001979
1980 Economy Health & Beauty Product Advanced Health & Beauty $743.67 376 3.8 899 SKU-001980
1981 Standard Books Product Mini Books $900.60 426 3.2 395 SKU-001981
1982 Professional Food & Grocery Product Classic Food & Grocery $405.35 219 3.8 878 SKU-001982
1983 Super Office Supplies Product XL Office Supplies $22.74 215 2.6 983 SKU-001983
1984 Deluxe Sports & Outdoors Product Advanced Sports & Outdoors $945.84 229 3.6 567 SKU-001984
1985 Mega Sports & Outdoors Product Max Sports & Outdoors $427.54 291 1.6 479 SKU-001985
1986 Professional Office Supplies Product Special Edition Office Supplies $314.96 150 2.4 743 SKU-001986
1987 Mega Electronics Product 2024 Electronics $609.06 269 4.6 252 SKU-001987
1988 Professional Sports & Outdoors Product 2024 Sports & Outdoors $475.69 184 4.1 307 SKU-001988
1989 Deluxe Office Supplies Product Pro Office Supplies $75.37 418 3.7 502 SKU-001989
1990 Professional Toys & Games Product XL Toys & Games $306.30 98 2.8 560 SKU-001990
1991 Standard Home & Garden Product Classic Home & Garden $37.20 210 3.4 947 SKU-001991
1992 Ultra Books Product 2024 Books $627.40 481 3.0 522 SKU-001992
1995 Deluxe Automotive Product Pro Automotive $700.98 108 3.9 873 SKU-001995
1996 Super Clothing Product Advanced Clothing $918.63 99 1.6 863 SKU-001996
1997 Mega Automotive Product Advanced Automotive $209.82 207 3.7 889 SKU-001997
1998 Deluxe Sports & Outdoors Product Mini Sports & Outdoors $833.19 43 1.6 467 SKU-001998
1999 Super Electronics Product Plus Electronics $625.95 448 2.0 181 SKU-001999
2000 Elite Food & Grocery Product Advanced Food & Grocery $570.58 411 2.5 117 SKU-002000
2001 Economy Toys & Games Product Mini Toys & Games $284.69 55 1.5 846 SKU-002001
2002 Pro Health & Beauty Product Plus Health & Beauty $522.69 460 4.5 394 SKU-002002
2003 Ultra Home & Garden Product Classic Home & Garden $191.40 333 3.3 88 SKU-002003
2004 Pro Books Product Mini Books $600.71 176 1.7 142 SKU-002004
2005 Elite Electronics Product Lite Electronics $208.66 332 1.4 385 SKU-002005
2006 Standard Electronics Product Mini Electronics $959.69 275 3.2 271 SKU-002006
2007 Pro Office Supplies Product Advanced Office Supplies $447.33 410 4.2 685 SKU-002007
2008 Professional Health & Beauty Product Plus Health & Beauty $13.19 373 2.7 542 SKU-002008
2009 Ultra Toys & Games Product Special Edition Toys & Games $961.72 229 4.6 247 SKU-002009
2010 Mega Clothing Product 2024 Clothing $979.62 341 2.0 714 SKU-002010
2011 Mega Food & Grocery Product XL Food & Grocery $918.27 335 4.3 153 SKU-002011
2012 Elite Toys & Games Product Classic Toys & Games $919.78 14 4.4 232 SKU-002012
2013 Super Food & Grocery Product Special Edition Food & Grocery $65.18 23 3.4 621 SKU-002013
2014 Elite Clothing Product Pro Clothing $175.95 212 2.2 916 SKU-002014
2016 Pro Toys & Games Product Special Edition Toys & Games $322.14 171 1.3 666 SKU-002016
2017 Standard Clothing Product Special Edition Clothing $82.44 136 1.1 932 SKU-002017
2018 Deluxe Health & Beauty Product Pro Health & Beauty $840.46 312 5.0 233 SKU-002018
2019 Pro Food & Grocery Product Advanced Food & Grocery $210.67 201 2.4 593 SKU-002019
2020 Premium Health & Beauty Product 2024 Health & Beauty $828.97 95 4.2 17 SKU-002020
2021 Deluxe Home & Garden Product 2024 Home & Garden $427.87 0 1.9 117 SKU-002021
2022 Mega Home & Garden Product 2024 Home & Garden $942.23 443 4.4 686 SKU-002022
2023 Premium Electronics Product XL Electronics $642.34 230 4.0 252 SKU-002023
2024 Economy Toys & Games Product Advanced Toys & Games $981.32 247 2.0 306 SKU-002024
2025 Pro Food & Grocery Product Special Edition Food & Grocery $149.09 286 3.7 78 SKU-002025
2027 Super Toys & Games Product Pro Toys & Games $549.07 133 2.3 993 SKU-002027
2028 Professional Health & Beauty Product Lite Health & Beauty $280.05 67 3.5 814 SKU-002028
2029 Mega Electronics Product Special Edition Electronics $859.54 485 2.8 546 SKU-002029
2032 Elite Automotive Product Advanced Automotive $755.69 383 2.1 761 SKU-002032
2033 Mega Health & Beauty Product Advanced Health & Beauty $761.92 317 2.7 286 SKU-002033
2034 Pro Toys & Games Product Special Edition Toys & Games $619.09 197 3.2 513 SKU-002034
Implementation Code
// Efficient pagination with Skip and Take
public async Task<PaginatedResult<DemoProduct>> GetPaginatedProductsAsync(int page, int pageSize)
{
    // Get total count (cached if possible)
    var totalCount = await _context.DemoProducts.CountAsync(p => p.IsActive);
    
    // Get page of results
    var items = await _context.DemoProducts
        .Where(p => p.IsActive)
        .OrderBy(p => p.Id) // Important: Must have ORDER BY for consistent paging
        .Skip((page - 1) * pageSize) // OFFSET in SQL
        .Take(pageSize) // FETCH NEXT in SQL
        .AsNoTracking() // No tracking needed for read-only
        .ToListAsync();

    return new PaginatedResult<DemoProduct>
    {
        Items = items,
        TotalCount = totalCount,
        Page = page,
        PageSize = pageSize
    };
}
Pagination Best Practices
  • Always use OrderBy: Skip/Take require stable sorting for consistent results
  • Use AsNoTracking(): Pagination queries are typically read-only
  • Consider caching: Cache total count if dataset changes infrequently
  • Limit max page size: Prevent users from requesting too many records at once
  • Use indexed columns: Ensure ORDER BY columns are indexed for performance