Efficient Pagination with Skip/Take

Efficient pagination using OFFSET-FETCH on SQL Server.

Execution Time

17 ms

Page Size

100

Current Page

15 / 245

Total Records

24441

Items per page: 25 50 100 200

Page 15 Results Showing 1401 - 1500 of 24441

ID Name Category Price Stock Rating Reviews SKU
1591 Professional Electronics Product Classic Electronics $314.21 367 3.6 639 SKU-001591
1592 Elite Books Product Pro Books $86.76 148 4.4 828 SKU-001592
1593 Super Sports & Outdoors Product Special Edition Sports & Outdoors $938.66 460 2.0 102 SKU-001593
1594 Economy Electronics Product Special Edition Electronics $572.30 94 4.9 616 SKU-001594
1595 Pro Electronics Product Mini Electronics $99.50 15 5.0 160 SKU-001595
1596 Ultra Health & Beauty Product Mini Health & Beauty $639.09 56 4.5 684 SKU-001596
1597 Economy Home & Garden Product Advanced Home & Garden $979.91 441 2.9 90 SKU-001597
1598 Premium Health & Beauty Product Mini Health & Beauty $785.69 73 1.4 377 SKU-001598
1599 Professional Electronics Product Classic Electronics $992.66 37 3.7 100 SKU-001599
1601 Standard Toys & Games Product Classic Toys & Games $214.65 353 2.1 641 SKU-001601
1602 Economy Toys & Games Product Advanced Toys & Games $706.45 150 2.4 381 SKU-001602
1603 Super Automotive Product Lite Automotive $156.29 440 1.2 706 SKU-001603
1605 Standard Food & Grocery Product Plus Food & Grocery $710.01 322 3.1 65 SKU-001605
1606 Premium Automotive Product Max Automotive $638.05 90 2.9 523 SKU-001606
1607 Pro Office Supplies Product Plus Office Supplies $717.60 41 2.5 876 SKU-001607
1608 Economy Automotive Product Max Automotive $84.06 329 1.5 672 SKU-001608
1609 Super Clothing Product Lite Clothing $518.98 78 2.2 49 SKU-001609
1610 Mega Books Product Special Edition Books $63.80 361 3.4 297 SKU-001610
1611 Ultra Home & Garden Product Classic Home & Garden $360.93 489 2.2 530 SKU-001611
1612 Pro Home & Garden Product Max Home & Garden $762.61 110 3.8 943 SKU-001612
1613 Mega Home & Garden Product Mini Home & Garden $838.96 186 4.0 333 SKU-001613
1614 Standard Books Product Max Books $551.45 422 2.9 172 SKU-001614
1615 Professional Electronics Product 2024 Electronics $217.56 430 2.9 63 SKU-001615
1616 Pro Books Product Advanced Books $651.50 142 3.8 263 SKU-001616
1617 Mega Food & Grocery Product Classic Food & Grocery $669.08 159 2.6 722 SKU-001617
1618 Standard Toys & Games Product Classic Toys & Games $19.79 429 1.8 575 SKU-001618
1619 Super Automotive Product Mini Automotive $159.38 86 3.6 781 SKU-001619
1620 Super Electronics Product Advanced Electronics $766.30 396 5.0 14 SKU-001620
1621 Professional Clothing Product Advanced Clothing $467.83 171 2.2 144 SKU-001621
1622 Deluxe Toys & Games Product Plus Toys & Games $420.91 441 4.2 316 SKU-001622
1624 Elite Home & Garden Product Lite Home & Garden $361.43 123 1.9 81 SKU-001624
1625 Ultra Toys & Games Product Classic Toys & Games $184.84 172 2.0 938 SKU-001625
1626 Elite Office Supplies Product Lite Office Supplies $999.35 352 1.8 509 SKU-001626
1627 Professional Toys & Games Product Mini Toys & Games $491.17 160 3.9 66 SKU-001627
1629 Elite Sports & Outdoors Product 2024 Sports & Outdoors $335.47 289 2.7 114 SKU-001629
1630 Mega Food & Grocery Product Advanced Food & Grocery $688.70 187 2.5 759 SKU-001630
1631 Premium Health & Beauty Product Lite Health & Beauty $495.55 247 4.4 367 SKU-001631
1632 Mega Books Product Plus Books $848.61 178 4.8 720 SKU-001632
1633 Premium Food & Grocery Product XL Food & Grocery $369.02 72 3.5 580 SKU-001633
1634 Elite Automotive Product Plus Automotive $451.92 349 3.1 323 SKU-001634
1635 Mega Office Supplies Product Mini Office Supplies $415.32 4 4.8 820 SKU-001635
1636 Deluxe Automotive Product Classic Automotive $602.73 366 2.3 691 SKU-001636
1637 Deluxe Books Product Special Edition Books $273.13 251 3.9 191 SKU-001637
1638 Professional Electronics Product Advanced Electronics $561.77 182 1.9 146 SKU-001638
1639 Super Toys & Games Product Pro Toys & Games $334.32 311 2.2 279 SKU-001639
1640 Economy Food & Grocery Product XL Food & Grocery $314.31 8 4.5 377 SKU-001640
1641 Ultra Electronics Product Classic Electronics $196.85 48 4.2 301 SKU-001641
1642 Standard Food & Grocery Product Advanced Food & Grocery $74.48 0 3.7 243 SKU-001642
1643 Economy Food & Grocery Product Plus Food & Grocery $486.97 105 4.3 257 SKU-001643
1644 Elite Clothing Product Lite Clothing $616.91 150 3.7 826 SKU-001644
1645 Deluxe Clothing Product XL Clothing $416.91 383 4.1 529 SKU-001645
1646 Premium Sports & Outdoors Product Lite Sports & Outdoors $834.17 113 3.8 430 SKU-001646
1647 Pro Health & Beauty Product Pro Health & Beauty $789.84 188 2.1 207 SKU-001647
1648 Elite Food & Grocery Product Advanced Food & Grocery $517.66 159 4.2 842 SKU-001648
1649 Ultra Toys & Games Product 2024 Toys & Games $666.52 12 3.0 329 SKU-001649
1650 Economy Automotive Product Classic Automotive $533.68 233 2.1 240 SKU-001650
1651 Professional Sports & Outdoors Product Advanced Sports & Outdoors $132.33 319 2.1 514 SKU-001651
1652 Pro Clothing Product Pro Clothing $427.22 219 1.2 583 SKU-001652
1654 Premium Office Supplies Product Max Office Supplies $381.87 258 4.6 735 SKU-001654
1655 Mega Home & Garden Product Mini Home & Garden $853.53 268 4.8 374 SKU-001655
1657 Pro Books Product Special Edition Books $948.84 166 4.2 131 SKU-001657
1658 Economy Electronics Product XL Electronics $803.11 348 1.9 114 SKU-001658
1659 Ultra Electronics Product Lite Electronics $675.29 433 1.1 549 SKU-001659
1660 Deluxe Books Product Pro Books $693.17 16 2.9 152 SKU-001660
1661 Professional Toys & Games Product Plus Toys & Games $860.47 50 2.7 863 SKU-001661
1662 Economy Health & Beauty Product Pro Health & Beauty $208.75 294 2.4 52 SKU-001662
1663 Ultra Health & Beauty Product Lite Health & Beauty $133.53 343 3.9 813 SKU-001663
1664 Mega Books Product Max Books $188.64 400 2.3 404 SKU-001664
1665 Premium Electronics Product XL Electronics $437.14 265 4.4 164 SKU-001665
1666 Ultra Electronics Product Classic Electronics $768.32 415 1.5 549 SKU-001666
1668 Mega Food & Grocery Product Lite Food & Grocery $302.98 48 3.5 125 SKU-001668
1669 Ultra Books Product 2024 Books $460.63 432 1.4 709 SKU-001669
1670 Pro Clothing Product Plus Clothing $544.89 255 3.5 557 SKU-001670
1671 Ultra Toys & Games Product Pro Toys & Games $697.86 23 1.5 271 SKU-001671
1672 Professional Health & Beauty Product Max Health & Beauty $828.21 461 3.3 924 SKU-001672
1673 Deluxe Books Product Plus Books $880.31 310 4.5 682 SKU-001673
1675 Professional Automotive Product Special Edition Automotive $299.31 335 2.0 27 SKU-001675
1676 Ultra Electronics Product Max Electronics $103.90 172 4.6 227 SKU-001676
1677 Elite Health & Beauty Product Special Edition Health & Beauty $769.39 401 4.7 365 SKU-001677
1678 Super Automotive Product Pro Automotive $693.03 408 2.6 238 SKU-001678
1679 Ultra Automotive Product Lite Automotive $90.60 108 2.7 709 SKU-001679
1681 Professional Health & Beauty Product Plus Health & Beauty $98.45 26 2.3 777 SKU-001681
1682 Ultra Home & Garden Product Advanced Home & Garden $860.07 104 2.9 517 SKU-001682
1683 Deluxe Food & Grocery Product Special Edition Food & Grocery $767.40 174 1.4 760 SKU-001683
1684 Economy Office Supplies Product XL Office Supplies $909.05 458 1.4 857 SKU-001684
1685 Professional Clothing Product Max Clothing $811.61 280 2.6 675 SKU-001685
1686 Professional Home & Garden Product Plus Home & Garden $906.25 306 4.5 911 SKU-001686
1687 Super Office Supplies Product XL Office Supplies $334.75 88 3.1 607 SKU-001687
1688 Elite Automotive Product Advanced Automotive $627.97 242 3.3 217 SKU-001688
1689 Deluxe Toys & Games Product Classic Toys & Games $268.37 96 4.4 449 SKU-001689
1690 Mega Home & Garden Product Plus Home & Garden $448.97 180 2.5 889 SKU-001690
1691 Elite Health & Beauty Product Plus Health & Beauty $145.34 46 3.8 670 SKU-001691
1693 Super Toys & Games Product Max Toys & Games $391.13 245 1.8 865 SKU-001693
1694 Deluxe Books Product Classic Books $464.01 303 2.8 108 SKU-001694
1695 Deluxe Food & Grocery Product Plus Food & Grocery $61.14 180 1.8 979 SKU-001695
1696 Economy Toys & Games Product Advanced Toys & Games $79.17 236 4.6 627 SKU-001696
1697 Pro Electronics Product Special Edition Electronics $497.12 288 3.7 656 SKU-001697
1698 Standard Toys & Games Product 2024 Toys & Games $136.10 281 2.1 928 SKU-001698
1699 Premium Books Product Pro Books $86.02 49 1.7 291 SKU-001699
1700 Deluxe Health & Beauty Product Classic Health & Beauty $981.85 72 1.4 882 SKU-001700
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