Efficient pagination using OFFSET-FETCH on SQL Server.
| ID | Name | Category | Price | Stock | Rating | Reviews | SKU |
|---|---|---|---|---|---|---|---|
| 674 | Pro Automotive Product Lite | Automotive | $740.79 | 456 | ★ 3.3 | 438 | SKU-000674 |
| 675 | Deluxe Office Supplies Product Classic | Office Supplies | $628.28 | 66 | ★ 4.6 | 928 | SKU-000675 |
| 676 | Elite Toys & Games Product Classic | Toys & Games | $746.25 | 116 | ★ 3.8 | 446 | SKU-000676 |
| 677 | Premium Home & Garden Product Advanced | Home & Garden | $38.46 | 434 | ★ 3.1 | 867 | SKU-000677 |
| 678 | Professional Office Supplies Product Max | Office Supplies | $691.40 | 445 | ★ 2.9 | 347 | SKU-000678 |
| 679 | Ultra Automotive Product XL | Automotive | $69.14 | 170 | ★ 1.3 | 955 | SKU-000679 |
| 680 | Elite Sports & Outdoors Product Lite | Sports & Outdoors | $321.22 | 268 | ★ 1.5 | 765 | SKU-000680 |
| 682 | Standard Food & Grocery Product Max | Food & Grocery | $951.89 | 160 | ★ 1.2 | 942 | SKU-000682 |
| 684 | Premium Books Product Lite | Books | $753.18 | 472 | ★ 3.8 | 736 | SKU-000684 |
| 685 | Elite Office Supplies Product Advanced | Office Supplies | $842.57 | 21 | ★ 1.1 | 432 | SKU-000685 |
| 686 | Standard Home & Garden Product Lite | Home & Garden | $975.48 | 196 | ★ 3.3 | 793 | SKU-000686 |
| 687 | Super Office Supplies Product Mini | Office Supplies | $455.36 | 244 | ★ 4.1 | 322 | SKU-000687 |
| 688 | Professional Home & Garden Product Lite | Home & Garden | $214.61 | 341 | ★ 3.1 | 380 | SKU-000688 |
| 689 | Elite Office Supplies Product Lite | Office Supplies | $735.13 | 78 | ★ 2.8 | 894 | SKU-000689 |
| 690 | Elite Sports & Outdoors Product Special Edition | Sports & Outdoors | $510.16 | 369 | ★ 3.0 | 113 | SKU-000690 |
| 691 | Standard Automotive Product Max | Automotive | $920.42 | 370 | ★ 1.6 | 877 | SKU-000691 |
| 692 | Professional Electronics Product Classic | Electronics | $507.53 | 317 | ★ 4.9 | 858 | SKU-000692 |
| 693 | Premium Health & Beauty Product Pro | Health & Beauty | $893.92 | 152 | ★ 3.2 | 89 | SKU-000693 |
| 694 | Deluxe Health & Beauty Product Advanced | Health & Beauty | $114.78 | 410 | ★ 2.9 | 630 | SKU-000694 |
| 695 | Standard Books Product Plus | Books | $897.17 | 409 | ★ 1.1 | 167 | SKU-000695 |
| 696 | Ultra Electronics Product Mini | Electronics | $542.62 | 80 | ★ 1.2 | 331 | SKU-000696 |
| 697 | Standard Home & Garden Product Lite | Home & Garden | $464.53 | 43 | ★ 2.7 | 566 | SKU-000697 |
| 698 | Economy Books Product Max | Books | $742.20 | 349 | ★ 3.5 | 293 | SKU-000698 |
| 699 | Super Books Product Special Edition | Books | $217.40 | 135 | ★ 3.4 | 465 | SKU-000699 |
| 700 | Mega Clothing Product Classic | Clothing | $232.79 | 231 | ★ 3.7 | 782 | SKU-000700 |
| 701 | Ultra Electronics Product Advanced | Electronics | $143.87 | 180 | ★ 1.5 | 980 | SKU-000701 |
| 702 | Ultra Automotive Product Plus | Automotive | $456.45 | 359 | ★ 2.2 | 518 | SKU-000702 |
| 703 | Pro Electronics Product Pro | Electronics | $526.63 | 409 | ★ 3.8 | 858 | SKU-000703 |
| 704 | Elite Electronics Product XL | Electronics | $844.16 | 493 | ★ 3.1 | 714 | SKU-000704 |
| 705 | Mega Toys & Games Product Plus | Toys & Games | $874.13 | 436 | ★ 2.5 | 566 | SKU-000705 |
| 707 | Mega Office Supplies Product Pro | Office Supplies | $189.54 | 463 | ★ 1.0 | 169 | SKU-000707 |
| 708 | Ultra Toys & Games Product Advanced | Toys & Games | $233.66 | 76 | ★ 4.8 | 709 | SKU-000708 |
| 709 | Ultra Toys & Games Product Advanced | Toys & Games | $825.67 | 380 | ★ 1.3 | 714 | SKU-000709 |
| 710 | Premium Electronics Product XL | Electronics | $75.94 | 110 | ★ 3.5 | 450 | SKU-000710 |
| 711 | Elite Sports & Outdoors Product Plus | Sports & Outdoors | $591.34 | 238 | ★ 2.8 | 631 | SKU-000711 |
| 712 | Elite Electronics Product Lite | Electronics | $121.43 | 7 | ★ 4.4 | 518 | SKU-000712 |
| 713 | Ultra Health & Beauty Product Plus | Health & Beauty | $132.72 | 495 | ★ 3.2 | 699 | SKU-000713 |
| 714 | Ultra Sports & Outdoors Product 2024 | Sports & Outdoors | $722.71 | 317 | ★ 4.1 | 855 | SKU-000714 |
| 715 | Super Home & Garden Product XL | Home & Garden | $442.54 | 278 | ★ 3.9 | 125 | SKU-000715 |
| 716 | Professional Books Product Mini | Books | $990.24 | 332 | ★ 2.3 | 934 | SKU-000716 |
| 717 | Super Automotive Product Special Edition | Automotive | $549.44 | 215 | ★ 4.4 | 649 | SKU-000717 |
| 718 | Pro Books Product Lite | Books | $715.86 | 315 | ★ 1.3 | 808 | SKU-000718 |
| 719 | Standard Clothing Product Max | Clothing | $634.33 | 356 | ★ 2.9 | 26 | SKU-000719 |
| 720 | Ultra Office Supplies Product Classic | Office Supplies | $936.60 | 17 | ★ 3.8 | 605 | SKU-000720 |
| 721 | Professional Health & Beauty Product Classic | Health & Beauty | $906.89 | 24 | ★ 4.7 | 613 | SKU-000721 |
| 722 | Standard Sports & Outdoors Product Pro | Sports & Outdoors | $369.30 | 70 | ★ 3.4 | 176 | SKU-000722 |
| 723 | Pro Sports & Outdoors Product Pro | Sports & Outdoors | $647.19 | 47 | ★ 4.4 | 499 | SKU-000723 |
| 724 | Deluxe Books Product Mini | Books | $776.85 | 194 | ★ 1.5 | 781 | SKU-000724 |
| 725 | Premium Electronics Product Classic | Electronics | $957.98 | 278 | ★ 3.0 | 76 | SKU-000725 |
| 726 | Ultra Clothing Product Classic | Clothing | $834.43 | 58 | ★ 4.3 | 244 | SKU-000726 |
| 727 | Deluxe Toys & Games Product Mini | Toys & Games | $422.17 | 41 | ★ 1.4 | 392 | SKU-000727 |
| 729 | Economy Books Product 2024 | Books | $799.51 | 363 | ★ 1.4 | 858 | SKU-000729 |
| 730 | Standard Food & Grocery Product Mini | Food & Grocery | $88.06 | 276 | ★ 4.5 | 14 | SKU-000730 |
| 731 | Premium Food & Grocery Product Max | Food & Grocery | $239.27 | 168 | ★ 2.0 | 234 | SKU-000731 |
| 732 | Economy Home & Garden Product 2024 | Home & Garden | $328.53 | 104 | ★ 4.1 | 509 | SKU-000732 |
| 733 | Pro Health & Beauty Product XL | Health & Beauty | $77.74 | 209 | ★ 4.4 | 283 | SKU-000733 |
| 734 | Pro Food & Grocery Product Mini | Food & Grocery | $856.73 | 175 | ★ 4.6 | 34 | SKU-000734 |
| 735 | Super Electronics Product Special Edition | Electronics | $899.40 | 432 | ★ 3.4 | 535 | SKU-000735 |
| 736 | Ultra Clothing Product Lite | Clothing | $621.71 | 177 | ★ 4.7 | 191 | SKU-000736 |
| 737 | Mega Office Supplies Product Advanced | Office Supplies | $650.13 | 169 | ★ 1.9 | 950 | SKU-000737 |
| 738 | Pro Electronics Product Mini | Electronics | $164.42 | 389 | ★ 4.4 | 243 | SKU-000738 |
| 739 | Standard Books Product Classic | Books | $101.76 | 365 | ★ 4.8 | 574 | SKU-000739 |
| 741 | Elite Toys & Games Product XL | Toys & Games | $314.85 | 382 | ★ 4.4 | 637 | SKU-000741 |
| 743 | Economy Food & Grocery Product Max | Food & Grocery | $174.03 | 21 | ★ 1.1 | 300 | SKU-000743 |
| 744 | Standard Automotive Product Pro | Automotive | $897.17 | 62 | ★ 1.2 | 488 | SKU-000744 |
| 745 | Professional Books Product Pro | Books | $951.08 | 248 | ★ 1.2 | 932 | SKU-000745 |
| 746 | Premium Electronics Product Mini | Electronics | $187.07 | 122 | ★ 2.8 | 234 | SKU-000746 |
| 747 | Mega Health & Beauty Product Advanced | Health & Beauty | $965.03 | 268 | ★ 4.9 | 677 | SKU-000747 |
| 748 | Deluxe Office Supplies Product Classic | Office Supplies | $764.80 | 499 | ★ 1.1 | 49 | SKU-000748 |
| 749 | Professional Automotive Product Plus | Automotive | $235.66 | 43 | ★ 1.9 | 385 | SKU-000749 |
| 750 | Mega Clothing Product Special Edition | Clothing | $649.42 | 437 | ★ 4.2 | 225 | SKU-000750 |
| 751 | Professional Health & Beauty Product Special Edition | Health & Beauty | $36.61 | 405 | ★ 4.6 | 970 | SKU-000751 |
| 752 | Deluxe Books Product Plus | Books | $911.02 | 341 | ★ 4.8 | 934 | SKU-000752 |
| 753 | Mega Health & Beauty Product Plus | Health & Beauty | $224.12 | 5 | ★ 2.9 | 863 | SKU-000753 |
| 754 | Pro Electronics Product Special Edition | Electronics | $384.02 | 95 | ★ 1.0 | 147 | SKU-000754 |
| 756 | Professional Food & Grocery Product XL | Food & Grocery | $915.47 | 355 | ★ 2.1 | 458 | SKU-000756 |
| 757 | Mega Toys & Games Product XL | Toys & Games | $34.26 | 22 | ★ 1.6 | 714 | SKU-000757 |
| 758 | Super Books Product Lite | Books | $288.77 | 97 | ★ 4.0 | 752 | SKU-000758 |
| 759 | Deluxe Clothing Product Special Edition | Clothing | $556.44 | 223 | ★ 4.6 | 653 | SKU-000759 |
| 760 | Deluxe Automotive Product Special Edition | Automotive | $569.15 | 112 | ★ 1.2 | 35 | SKU-000760 |
| 761 | Standard Food & Grocery Product Advanced | Food & Grocery | $54.26 | 454 | ★ 4.6 | 885 | SKU-000761 |
| 762 | Super Food & Grocery Product 2024 | Food & Grocery | $412.20 | 24 | ★ 3.2 | 578 | SKU-000762 |
| 763 | Premium Clothing Product Lite | Clothing | $881.56 | 156 | ★ 3.3 | 61 | SKU-000763 |
| 764 | Deluxe Automotive Product Plus | Automotive | $246.78 | 165 | ★ 4.7 | 77 | SKU-000764 |
| 765 | Economy Health & Beauty Product Plus | Health & Beauty | $409.97 | 434 | ★ 1.1 | 777 | SKU-000765 |
| 766 | Standard Automotive Product Special Edition | Automotive | $905.73 | 474 | ★ 3.5 | 76 | SKU-000766 |
| 767 | Economy Clothing Product Plus | Clothing | $386.34 | 104 | ★ 4.9 | 387 | SKU-000767 |
| 768 | Elite Sports & Outdoors Product XL | Sports & Outdoors | $283.12 | 257 | ★ 4.2 | 520 | SKU-000768 |
| 769 | Economy Clothing Product 2024 | Clothing | $474.44 | 283 | ★ 2.3 | 440 | SKU-000769 |
| 770 | Professional Books Product Special Edition | Books | $930.22 | 488 | ★ 2.2 | 582 | SKU-000770 |
| 771 | Standard Automotive Product Pro | Automotive | $336.73 | 380 | ★ 2.3 | 931 | SKU-000771 |
| 773 | Mega Clothing Product Plus | Clothing | $962.22 | 222 | ★ 3.4 | 363 | SKU-000773 |
| 774 | Professional Electronics Product Pro | Electronics | $219.68 | 318 | ★ 3.7 | 948 | SKU-000774 |
| 775 | Elite Home & Garden Product Lite | Home & Garden | $275.64 | 401 | ★ 2.9 | 640 | SKU-000775 |
| 776 | Super Home & Garden Product Mini | Home & Garden | $875.13 | 18 | ★ 3.2 | 939 | SKU-000776 |
| 777 | Pro Toys & Games Product Mini | Toys & Games | $638.31 | 338 | ★ 3.4 | 330 | SKU-000777 |
| 778 | Premium Food & Grocery Product XL | Food & Grocery | $259.19 | 170 | ★ 4.7 | 784 | SKU-000778 |
| 780 | Professional Toys & Games Product Lite | Toys & Games | $621.92 | 198 | ★ 3.8 | 629 | SKU-000780 |
| 781 | Elite Home & Garden Product Mini | Home & Garden | $724.33 | 28 | ★ 1.6 | 911 | SKU-000781 |
| 782 | Economy Food & Grocery Product Plus | Food & Grocery | $836.40 | 66 | ★ 1.4 | 719 | SKU-000782 |
// 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
};
}