Efficient pagination using OFFSET-FETCH on SQL Server.
| ID | Name | Category | Price | Stock | Rating | Reviews | SKU |
|---|---|---|---|---|---|---|---|
| 17660 | Bulk Product ed5a4842 | Books | $190.76 | 141 | ★ 2.4 | 32 | BULK-d87bcefe |
| 17661 | Bulk Product 783f2e2a | Home & Garden | $998.88 | 7 | ★ 0.3 | 82 | BULK-1e7c3f9a |
| 17662 | Bulk Product 45db0e96 | Electronics | $161.38 | 365 | ★ 3.2 | 16 | BULK-feaab0c0 |
| 17663 | Bulk Product 592e42bb | Clothing | $979.00 | 158 | ★ 1.8 | 85 | BULK-6e84146d |
| 17664 | Bulk Product f40066e1 | Sports & Outdoors | $40.90 | 405 | ★ 2.5 | 56 | BULK-81e160f2 |
| 17665 | Bulk Product 6b82e0a8 | Toys & Games | $795.14 | 82 | ★ 0.0 | 75 | BULK-8eca28f7 |
| 17666 | Bulk Product f25811ed | Sports & Outdoors | $112.73 | 120 | ★ 1.0 | 57 | BULK-cf41a7d4 |
| 17667 | Bulk Product f0a788e5 | Home & Garden | $618.80 | 498 | ★ 3.1 | 41 | BULK-efa9543f |
| 17668 | Bulk Product c498a28f | Electronics | $930.86 | 165 | ★ 0.8 | 19 | BULK-8dd67e78 |
| 17669 | Bulk Product 9e9941a3 | Clothing | $768.44 | 371 | ★ 1.6 | 52 | BULK-65e695c8 |
| 17670 | Bulk Product f4f68516 | Toys & Games | $174.77 | 127 | ★ 4.4 | 57 | BULK-80516f62 |
| 17671 | Bulk Product 143c64d5 | Toys & Games | $537.90 | 276 | ★ 3.1 | 68 | BULK-5f34990b |
| 17672 | Bulk Product 7d370719 | Books | $342.00 | 461 | ★ 1.4 | 53 | BULK-11003a0d |
| 17673 | Bulk Product f9fd689b | Sports & Outdoors | $833.61 | 117 | ★ 0.4 | 98 | BULK-aae96f4f |
| 17674 | Bulk Product 4102118c | Clothing | $55.72 | 269 | ★ 1.9 | 73 | BULK-c6e1dae9 |
| 17675 | Bulk Product d0a56e40 | Books | $202.66 | 105 | ★ 4.2 | 11 | BULK-47d8f99e |
| 17676 | Bulk Product a38c7a18 | Toys & Games | $699.95 | 277 | ★ 2.1 | 27 | BULK-6ca93f86 |
| 17677 | Bulk Product 6a3d4545 | Sports & Outdoors | $614.88 | 37 | ★ 0.4 | 41 | BULK-1c69e554 |
| 17678 | Bulk Product 090c05f5 | Clothing | $971.84 | 235 | ★ 2.3 | 68 | BULK-55dc26de |
| 17679 | Bulk Product 3f79edd6 | Electronics | $569.73 | 45 | ★ 3.5 | 79 | BULK-5e335bcf |
| 17680 | Bulk Product 5eac6551 | Sports & Outdoors | $564.58 | 215 | ★ 3.4 | 79 | BULK-5ab91882 |
| 17681 | Bulk Product a80a1c7b | Electronics | $773.74 | 460 | ★ 1.8 | 54 | BULK-839b5cd6 |
| 17682 | Bulk Product 567e57be | Sports & Outdoors | $1,007.56 | 114 | ★ 0.3 | 64 | BULK-f8cc5569 |
| 17683 | Bulk Product 2f8e5f5f | Clothing | $721.85 | 296 | ★ 3.7 | 7 | BULK-c324ff99 |
| 17684 | Bulk Product ce4b86ce | Home & Garden | $248.56 | 29 | ★ 3.7 | 64 | BULK-c46b0e73 |
| 17685 | Bulk Product 86337407 | Sports & Outdoors | $772.96 | 23 | ★ 4.1 | 10 | BULK-8892df98 |
| 17686 | Bulk Product 1bf4d7c6 | Toys & Games | $648.40 | 82 | ★ 0.9 | 12 | BULK-74c15aa0 |
| 17687 | Bulk Product d7c38a84 | Sports & Outdoors | $644.01 | 351 | ★ 0.7 | 56 | BULK-82b6e810 |
| 17688 | Bulk Product 05d28e8c | Sports & Outdoors | $586.91 | 259 | ★ 0.3 | 89 | BULK-62a56428 |
| 17689 | Bulk Product b3ff06e8 | Clothing | $758.79 | 314 | ★ 1.1 | 40 | BULK-0b66cea1 |
| 17690 | Bulk Product 242e880b | Sports & Outdoors | $477.75 | 265 | ★ 0.7 | 24 | BULK-263d00fb |
| 17691 | Bulk Product 835bef97 | Sports & Outdoors | $42.63 | 286 | ★ 1.3 | 94 | BULK-cbbcf395 |
| 17692 | Bulk Product f250e0f5 | Sports & Outdoors | $572.89 | 279 | ★ 0.8 | 51 | BULK-8d6e33e5 |
| 17693 | Bulk Product a7141f14 | Sports & Outdoors | $921.01 | 177 | ★ 2.6 | 86 | BULK-32bced74 |
| 17694 | Bulk Product fab20c2b | Clothing | $507.17 | 291 | ★ 3.5 | 71 | BULK-0cb16f39 |
| 17695 | Bulk Product 8804b82f | Home & Garden | $525.76 | 103 | ★ 1.3 | 65 | BULK-8e6aefaf |
| 17696 | Bulk Product 0a922eb1 | Clothing | $403.42 | 422 | ★ 0.8 | 7 | BULK-8300f0d3 |
| 17697 | Bulk Product a5236eea | Sports & Outdoors | $258.82 | 68 | ★ 3.6 | 13 | BULK-67da6512 |
| 17698 | Bulk Product 5b8e12b6 | Sports & Outdoors | $865.54 | 135 | ★ 0.5 | 21 | BULK-c4819a23 |
| 17699 | Bulk Product 71d6753c | Toys & Games | $629.32 | 147 | ★ 0.4 | 6 | BULK-17c71a5c |
| 17700 | Bulk Product 039a0e4b | Books | $224.10 | 326 | ★ 0.2 | 9 | BULK-8985e2a5 |
| 17701 | Bulk Product 7c35f0d7 | Sports & Outdoors | $952.06 | 438 | ★ 0.0 | 17 | BULK-9eb70f25 |
| 17702 | Bulk Product a5fde51f | Home & Garden | $326.51 | 11 | ★ 0.3 | 64 | BULK-0679a34a |
| 17703 | Bulk Product 2dd502cd | Sports & Outdoors | $671.71 | 349 | ★ 0.2 | 82 | BULK-287db9bb |
| 17704 | Bulk Product 3a0c7253 | Books | $119.72 | 426 | ★ 2.9 | 24 | BULK-244ad9b7 |
| 17705 | Bulk Product 412ecf94 | Home & Garden | $383.86 | 160 | ★ 2.9 | 63 | BULK-1c8f376f |
| 17706 | Bulk Product a6027d4c | Electronics | $648.96 | 230 | ★ 0.7 | 66 | BULK-4bce2395 |
| 17707 | Bulk Product 4daa260b | Clothing | $770.11 | 2 | ★ 0.6 | 61 | BULK-2c98bec3 |
| 17708 | Bulk Product 6669db60 | Clothing | $687.02 | 372 | ★ 3.0 | 93 | BULK-7854d0d5 |
| 17709 | Bulk Product d1c91c46 | Books | $340.57 | 30 | ★ 3.8 | 92 | BULK-5b45690b |
| 17710 | Bulk Product fbfff5df | Toys & Games | $427.62 | 101 | ★ 3.2 | 85 | BULK-f38f5597 |
| 17711 | Bulk Product 619dbc5e | Home & Garden | $441.35 | 104 | ★ 1.8 | 69 | BULK-1a41e6f8 |
| 17712 | Bulk Product e5d8885e | Clothing | $124.84 | 121 | ★ 2.9 | 75 | BULK-36b684af |
| 17713 | Bulk Product f2862fdb | Electronics | $264.41 | 308 | ★ 0.9 | 23 | BULK-80063a32 |
| 17714 | Bulk Product b1e2f642 | Electronics | $677.06 | 168 | ★ 3.3 | 47 | BULK-fd18b165 |
| 17715 | Bulk Product cfcdd464 | Books | $370.29 | 113 | ★ 1.7 | 18 | BULK-7f3fc129 |
| 17716 | Bulk Product 0d763c79 | Toys & Games | $608.15 | 172 | ★ 2.2 | 56 | BULK-bf0f5dde |
| 17717 | Bulk Product f08da7f5 | Books | $17.85 | 294 | ★ 2.6 | 19 | BULK-2130d7e3 |
| 17718 | Bulk Product fbc34052 | Clothing | $53.12 | 4 | ★ 3.6 | 72 | BULK-4a1147f6 |
| 17719 | Bulk Product 36ea0e83 | Clothing | $901.86 | 432 | ★ 0.7 | 46 | BULK-6e863104 |
| 17720 | Bulk Product 1228d4b3 | Clothing | $93.65 | 382 | ★ 5.0 | 92 | BULK-b475d93e |
| 17721 | Bulk Product a5d9a108 | Electronics | $54.31 | 82 | ★ 2.7 | 87 | BULK-688d58d9 |
| 17722 | Bulk Product 03a9deb4 | Books | $911.02 | 477 | ★ 2.8 | 86 | BULK-05506b5c |
| 17723 | Bulk Product 9a70eaac | Home & Garden | $980.99 | 114 | ★ 1.5 | 7 | BULK-13996307 |
| 17724 | Bulk Product 55b97fb4 | Toys & Games | $96.45 | 295 | ★ 3.7 | 65 | BULK-709e9e8c |
| 17725 | Bulk Product 34ee5d59 | Books | $148.35 | 190 | ★ 1.1 | 39 | BULK-20ec0f66 |
| 17726 | Bulk Product 793aff17 | Sports & Outdoors | $898.65 | 245 | ★ 2.6 | 4 | BULK-68cf0df1 |
| 17727 | Bulk Product a2172d74 | Books | $707.11 | 147 | ★ 0.8 | 76 | BULK-705fa563 |
| 17728 | Bulk Product fd3dd862 | Sports & Outdoors | $414.70 | 293 | ★ 1.0 | 71 | BULK-560702b5 |
| 17729 | Bulk Product 719def49 | Electronics | $557.99 | 357 | ★ 3.2 | 17 | BULK-c752f7b4 |
| 17730 | Bulk Product c14d8929 | Home & Garden | $470.05 | 227 | ★ 3.6 | 12 | BULK-f25827df |
| 17731 | Bulk Product c52db8f4 | Electronics | $620.49 | 179 | ★ 1.1 | 22 | BULK-25db8d4d |
| 17732 | Bulk Product 6f0c34c3 | Electronics | $645.61 | 478 | ★ 1.0 | 30 | BULK-3181c350 |
| 17733 | Bulk Product ae2c98be | Electronics | $325.41 | 351 | ★ 2.0 | 55 | BULK-d0cc267b |
| 17734 | Bulk Product f6cddfc7 | Books | $83.43 | 387 | ★ 5.0 | 74 | BULK-109d9c96 |
| 17735 | Bulk Product eedb1793 | Home & Garden | $991.26 | 177 | ★ 2.4 | 6 | BULK-a582bb7f |
| 17736 | Bulk Product 38497f6b | Books | $228.05 | 434 | ★ 0.6 | 59 | BULK-9ed8f234 |
| 17737 | Bulk Product dcfa82d4 | Clothing | $375.32 | 205 | ★ 2.5 | 28 | BULK-975cd2ec |
| 17738 | Bulk Product 9eb7888f | Home & Garden | $663.71 | 495 | ★ 1.1 | 22 | BULK-af0efddd |
| 17739 | Bulk Product 7952027b | Toys & Games | $350.88 | 245 | ★ 2.5 | 15 | BULK-9c168f78 |
| 17740 | Bulk Product 460f344e | Clothing | $130.20 | 61 | ★ 3.6 | 92 | BULK-bf0f37dc |
| 17741 | Bulk Product dc355bc0 | Books | $973.53 | 486 | ★ 2.5 | 79 | BULK-185a6530 |
| 17742 | Bulk Product 0b8e6927 | Sports & Outdoors | $364.09 | 141 | ★ 0.6 | 33 | BULK-c728b7c1 |
| 17743 | Bulk Product 3e9cdabf | Books | $860.17 | 2 | ★ 2.6 | 11 | BULK-ef2ca797 |
| 17744 | Bulk Product 29054d41 | Sports & Outdoors | $763.81 | 416 | ★ 3.7 | 8 | BULK-a80d588e |
| 17745 | Bulk Product 4fdf3071 | Toys & Games | $875.37 | 437 | ★ 4.8 | 25 | BULK-1de86846 |
| 17746 | Bulk Product 03a97f95 | Books | $325.25 | 385 | ★ 1.5 | 86 | BULK-f61c49df |
| 17747 | Bulk Product c298634e | Clothing | $530.03 | 253 | ★ 0.2 | 23 | BULK-2128c67e |
| 17748 | Bulk Product 7e697ba1 | Electronics | $426.64 | 381 | ★ 4.2 | 78 | BULK-42c57865 |
| 17749 | Bulk Product 0d6c4737 | Toys & Games | $462.48 | 408 | ★ 0.9 | 76 | BULK-1359f06b |
| 17750 | Bulk Product faf3dae1 | Toys & Games | $176.83 | 418 | ★ 4.5 | 85 | BULK-913a34bd |
| 17751 | Bulk Product 243ef342 | Clothing | $696.05 | 457 | ★ 4.6 | 9 | BULK-8738073e |
| 17752 | Bulk Product 8b3ca519 | Home & Garden | $902.65 | 241 | ★ 2.6 | 94 | BULK-574ededc |
| 17753 | Bulk Product 73f77c3d | Electronics | $954.70 | 18 | ★ 3.1 | 23 | BULK-79f57b4a |
| 17754 | Bulk Product c2dae8d2 | Sports & Outdoors | $560.17 | 406 | ★ 1.1 | 78 | BULK-36253a4f |
| 17755 | Bulk Product cc24bd41 | Electronics | $518.06 | 140 | ★ 1.0 | 35 | BULK-87acfdab |
| 17756 | Bulk Product 5f0d9fd8 | Home & Garden | $498.96 | 178 | ★ 1.2 | 83 | BULK-f513bb41 |
| 17757 | Bulk Product 5f5f89c7 | Toys & Games | $863.50 | 366 | ★ 0.7 | 89 | BULK-f86d2d3b |
| 17758 | Bulk Product b5267e38 | Sports & Outdoors | $100.23 | 111 | ★ 1.2 | 48 | BULK-edbc947a |
| 17759 | Bulk Product 88a96325 | Toys & Games | $863.21 | 254 | ★ 0.9 | 97 | BULK-5ad7ad6a |
// 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
};
}