Efficient Pagination with Skip/Take

Efficient pagination using OFFSET-FETCH on SQL Server.

Execution Time

67 ms

Page Size

100

Current Page

100 / 245

Total Records

24441

Items per page: 25 50 100 200

Page 100 Results Showing 9901 - 10000 of 24441

ID Name Category Price Stock Rating Reviews SKU
10460 Bulk Product ab030da6 Books $815.62 462 3.8 40 BULK-ccc90dfa
10461 Bulk Product 54d0252f Home & Garden $818.70 14 0.3 2 BULK-bda66ad3
10462 Bulk Product 42fd88a2 Electronics $848.47 9 3.1 20 BULK-cc2b4656
10463 Bulk Product 61e95231 Electronics $508.01 375 0.9 88 BULK-b7341805
10464 Bulk Product 71c82a2a Toys & Games $243.33 256 2.0 40 BULK-aaff1171
10465 Bulk Product 9f9b4743 Sports & Outdoors $157.65 403 4.9 72 BULK-8fa95cb2
10466 Bulk Product bab00a33 Home & Garden $971.28 433 4.8 78 BULK-a44d1173
10467 Bulk Product 184f92c6 Home & Garden $145.81 458 3.3 42 BULK-78a5bef4
10468 Bulk Product 99809238 Books $436.25 212 1.7 61 BULK-79fb691d
10469 Bulk Product d03a9e4f Clothing $814.27 492 4.0 14 BULK-64b686a8
10470 Bulk Product af82f611 Toys & Games $551.31 457 3.2 50 BULK-e62f1954
10471 Bulk Product 78ebd7dc Books $356.30 129 1.3 44 BULK-58ddac8a
10472 Bulk Product 6b092c50 Books $203.66 239 2.2 10 BULK-552fafeb
10473 Bulk Product 908d0431 Books $205.77 119 3.8 87 BULK-a10484e2
10474 Bulk Product 7d0fd76a Sports & Outdoors $905.00 379 2.8 29 BULK-b94cae1e
10475 Bulk Product 96c41ae7 Sports & Outdoors $370.21 483 4.2 17 BULK-c0d0d493
10476 Bulk Product c01a05cd Electronics $356.28 351 2.9 71 BULK-ca553f07
10477 Bulk Product f17180fe Toys & Games $77.38 401 2.3 67 BULK-4e59930e
10478 Bulk Product 2e6dd608 Clothing $279.73 33 4.3 15 BULK-71803da6
10479 Bulk Product c5362caf Books $19.23 100 3.4 50 BULK-afd2fe60
10480 Bulk Product 8f3d507a Clothing $583.77 180 3.9 79 BULK-973ce432
10481 Bulk Product bc7e66b0 Sports & Outdoors $611.50 267 3.5 29 BULK-c031907d
10482 Bulk Product 0598d35d Toys & Games $883.91 52 2.2 21 BULK-e0aefd50
10483 Bulk Product 97ea7d07 Electronics $557.90 1 4.9 59 BULK-25080311
10484 Bulk Product 417e4f90 Sports & Outdoors $272.04 141 0.2 24 BULK-4a612f4c
10485 Bulk Product dab1e557 Sports & Outdoors $928.15 94 0.4 58 BULK-506f22d3
10486 Bulk Product d6766ed8 Sports & Outdoors $985.24 463 3.1 54 BULK-83e0d44f
10487 Bulk Product c7e46cb3 Home & Garden $337.20 464 1.8 70 BULK-05d2227d
10488 Bulk Product 56601995 Electronics $179.90 246 1.4 57 BULK-f39a8994
10489 Bulk Product 5224dac4 Sports & Outdoors $821.32 8 1.2 6 BULK-ff39ddfb
10490 Bulk Product 7ab71023 Sports & Outdoors $150.52 489 0.7 93 BULK-8c44e4df
10491 Bulk Product eb3e15ce Books $602.71 451 0.1 48 BULK-200e8c08
10492 Bulk Product 63e72787 Clothing $52.57 48 2.3 84 BULK-5e355fde
10493 Bulk Product 9b483eca Sports & Outdoors $323.55 489 1.7 83 BULK-61ecc65f
10494 Bulk Product ff8634e7 Clothing $656.45 203 3.3 97 BULK-1d69d899
10495 Bulk Product a989e3fa Home & Garden $607.61 72 1.8 80 BULK-fa7d517e
10496 Bulk Product a7fccd13 Home & Garden $890.65 67 3.0 37 BULK-acbe9d68
10497 Bulk Product 001de619 Sports & Outdoors $633.88 199 3.4 47 BULK-a68c8f5a
10498 Bulk Product 74690e03 Clothing $783.23 41 3.5 22 BULK-d95031ed
10499 Bulk Product dc95a9fe Sports & Outdoors $791.39 486 0.6 46 BULK-b0ccf033
10500 Bulk Product b5149614 Electronics $31.51 327 2.7 75 BULK-b7e9a233
10501 Bulk Product 700e7f6c Home & Garden $1,006.74 98 1.0 80 BULK-a4a7e9ba
10502 Bulk Product 614b6750 Toys & Games $876.30 439 1.0 13 BULK-ec6dd410
10503 Bulk Product c8523278 Home & Garden $812.47 373 4.2 97 BULK-f86d1723
10504 Bulk Product 13f00113 Clothing $856.57 445 1.5 50 BULK-0ddbde1a
10505 Bulk Product 2f967b7a Sports & Outdoors $533.68 336 1.6 14 BULK-801b9313
10506 Bulk Product 0cb9acb4 Home & Garden $597.07 135 2.3 64 BULK-f4459557
10507 Bulk Product 9c8a71f1 Toys & Games $695.17 409 3.9 22 BULK-76255acd
10508 Bulk Product 507205f0 Electronics $919.58 18 3.6 94 BULK-b47f5152
10509 Bulk Product f706c08b Toys & Games $843.98 306 4.1 59 BULK-9ac09d70
10510 Bulk Product 5c5a487a Clothing $827.27 231 1.2 92 BULK-27274de4
10511 Bulk Product d893e944 Home & Garden $263.79 16 0.1 84 BULK-3de7dc39
10512 Bulk Product 18e796dc Clothing $891.69 155 1.7 91 BULK-968d672e
10513 Bulk Product 0dbf98c2 Sports & Outdoors $630.85 497 2.2 86 BULK-009b5555
10514 Bulk Product 1fedde86 Sports & Outdoors $664.08 181 1.6 53 BULK-2d12de69
10515 Bulk Product 59498582 Books $136.87 181 2.3 80 BULK-43c36bfc
10516 Bulk Product 3514e04b Sports & Outdoors $443.57 237 4.2 27 BULK-61439f87
10517 Bulk Product c1d28a1a Toys & Games $460.13 51 2.4 71 BULK-b90a7ed3
10518 Bulk Product 997d3383 Electronics $809.93 297 4.0 18 BULK-73ed8f20
10519 Bulk Product c41d2e75 Clothing $751.37 127 3.0 33 BULK-86dd7209
10520 Bulk Product d9d59f30 Books $381.01 160 0.6 63 BULK-466cc520
10521 Bulk Product 70d0085e Toys & Games $887.96 15 0.4 48 BULK-6856c290
10522 Bulk Product a5c71f58 Toys & Games $193.89 226 3.4 48 BULK-48e02fe0
10523 Bulk Product faa8ee94 Toys & Games $209.48 413 3.0 93 BULK-9593775f
10524 Bulk Product 9131f6d2 Toys & Games $578.10 88 4.1 59 BULK-5be07fe4
10525 Bulk Product 25f58f14 Electronics $540.16 106 1.8 79 BULK-88496ae0
10526 Bulk Product 0f9300c8 Toys & Games $447.21 133 3.7 95 BULK-01817abf
10527 Bulk Product 4c03d18b Books $734.98 111 2.2 48 BULK-c18f9acd
10528 Bulk Product 94c32420 Sports & Outdoors $347.04 46 4.1 63 BULK-daee1820
10529 Bulk Product d185fa24 Sports & Outdoors $457.67 292 1.7 76 BULK-9a669126
10530 Bulk Product 59539d4d Books $207.91 204 3.8 41 BULK-213369b2
10531 Bulk Product 8ecbad6d Electronics $48.05 55 3.2 28 BULK-d9ab1ab4
10532 Bulk Product b54f9c69 Clothing $494.22 473 1.9 54 BULK-56e8da9f
10533 Bulk Product 2b8f9818 Clothing $381.27 3 1.4 44 BULK-ebd776e2
10534 Bulk Product 838e2095 Clothing $358.76 160 2.6 32 BULK-c773f183
10535 Bulk Product 43a32ec5 Home & Garden $755.89 49 1.6 83 BULK-bdc98050
10536 Bulk Product 4c0ed2ea Books $812.77 93 2.9 86 BULK-30575a1b
10537 Bulk Product b186cedf Electronics $212.32 102 0.7 0 BULK-a9d621e1
10538 Bulk Product b9e8f393 Books $351.65 3 3.1 76 BULK-b640c368
10539 Bulk Product 0c7e4d48 Clothing $947.00 447 1.3 32 BULK-5472518d
10540 Bulk Product 19986bf4 Clothing $33.59 368 2.5 24 BULK-3ef88a15
10541 Bulk Product acd4239b Toys & Games $302.35 141 3.1 98 BULK-ca81a78c
10542 Bulk Product 552cff6b Electronics $871.96 243 4.7 32 BULK-1025d133
10543 Bulk Product 2e7678e6 Clothing $646.73 412 2.0 89 BULK-a5f2778a
10544 Bulk Product bbf0ce58 Electronics $383.60 172 4.5 38 BULK-1559f40f
10545 Bulk Product ebb56482 Books $221.61 394 4.6 3 BULK-5ab2c503
10546 Bulk Product dbd1ecee Home & Garden $156.87 407 4.4 72 BULK-c2853ee4
10547 Bulk Product b8d7dc98 Books $58.87 485 2.6 72 BULK-421f0245
10548 Bulk Product 55849927 Clothing $269.22 236 4.2 58 BULK-529fff32
10549 Bulk Product 38364dc4 Toys & Games $440.44 485 2.2 67 BULK-8d028ba1
10550 Bulk Product 19366457 Books $847.00 185 3.8 69 BULK-7192baa9
10551 Bulk Product 6b1e2a66 Toys & Games $898.88 56 2.1 8 BULK-77c5bb9c
10552 Bulk Product 68954f27 Home & Garden $570.30 251 0.8 95 BULK-bef4288b
10553 Bulk Product b43f9e1b Home & Garden $333.03 381 0.2 26 BULK-41659ff6
10554 Bulk Product c48cdb9b Clothing $920.58 98 1.2 1 BULK-ffcffeec
10555 Bulk Product 849a2016 Toys & Games $251.16 369 1.1 18 BULK-1784fb6d
10556 Bulk Product a3e80170 Home & Garden $911.34 229 0.1 0 BULK-43c79f97
10557 Bulk Product a7c15f13 Sports & Outdoors $151.59 479 0.2 8 BULK-3165d12f
10558 Bulk Product 0da12b06 Toys & Games $639.11 85 1.1 82 BULK-dc7cda01
10559 Bulk Product 797d23a6 Clothing $183.43 235 3.7 53 BULK-228e77df
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