Efficient pagination using OFFSET-FETCH on SQL Server.
| ID | Name | Category | Price | Stock | Rating | Reviews | SKU |
|---|---|---|---|---|---|---|---|
| 18260 | Bulk Product 2594b2db | Electronics | $821.76 | 241 | ★ 1.0 | 75 | BULK-0fc55b4c |
| 18261 | Bulk Product 97344815 | Home & Garden | $534.81 | 208 | ★ 4.9 | 66 | BULK-1e380e62 |
| 18262 | Bulk Product 3c741ca5 | Books | $678.89 | 348 | ★ 3.5 | 69 | BULK-8c1b5e6e |
| 18263 | Bulk Product 2bdd334b | Toys & Games | $151.53 | 375 | ★ 4.1 | 77 | BULK-bb2a2869 |
| 18264 | Bulk Product ce5d5503 | Sports & Outdoors | $535.92 | 107 | ★ 2.0 | 11 | BULK-a758f70c |
| 18265 | Bulk Product 7099e731 | Electronics | $213.56 | 402 | ★ 4.0 | 21 | BULK-aa0cb176 |
| 18266 | Bulk Product dc51a180 | Clothing | $20.47 | 134 | ★ 4.0 | 5 | BULK-36d37eb9 |
| 18267 | Bulk Product 07d02512 | Electronics | $381.47 | 112 | ★ 1.6 | 95 | BULK-a4525ca2 |
| 18268 | Bulk Product 50242fde | Electronics | $880.73 | 376 | ★ 0.8 | 34 | BULK-d864a488 |
| 18269 | Bulk Product 2bf7243c | Toys & Games | $301.14 | 141 | ★ 3.7 | 60 | BULK-4390ee34 |
| 18270 | Bulk Product a79b5855 | Sports & Outdoors | $463.41 | 79 | ★ 4.4 | 35 | BULK-bdede83a |
| 18271 | Bulk Product 9d96a7dc | Electronics | $260.23 | 293 | ★ 4.6 | 12 | BULK-4bec14a8 |
| 18272 | Bulk Product 0c6b41e7 | Clothing | $396.18 | 3 | ★ 1.0 | 15 | BULK-9a072a80 |
| 18273 | Bulk Product e85756dd | Toys & Games | $71.21 | 416 | ★ 4.6 | 54 | BULK-c1876261 |
| 18274 | Bulk Product d675d46b | Toys & Games | $973.62 | 359 | ★ 0.1 | 31 | BULK-448fddd5 |
| 18275 | Bulk Product c5ba8c01 | Sports & Outdoors | $1,000.31 | 453 | ★ 1.7 | 24 | BULK-e4cd185b |
| 18276 | Bulk Product 6abca393 | Sports & Outdoors | $760.35 | 9 | ★ 2.3 | 93 | BULK-aedc566f |
| 18277 | Bulk Product ed0f8707 | Sports & Outdoors | $608.30 | 56 | ★ 3.0 | 27 | BULK-07fc3307 |
| 18278 | Bulk Product 00dc3b5a | Books | $407.07 | 245 | ★ 0.1 | 56 | BULK-edb813d2 |
| 18279 | Bulk Product a192cf02 | Clothing | $38.00 | 357 | ★ 3.5 | 12 | BULK-44e2d0ae |
| 18280 | Bulk Product b89e12b8 | Sports & Outdoors | $883.37 | 116 | ★ 3.0 | 28 | BULK-ea088b18 |
| 18281 | Bulk Product 3f27e813 | Toys & Games | $357.98 | 188 | ★ 0.2 | 9 | BULK-170c415e |
| 18282 | Bulk Product 16477f22 | Electronics | $615.09 | 285 | ★ 0.1 | 50 | BULK-8fa40648 |
| 18283 | Bulk Product 4422ca90 | Clothing | $513.67 | 406 | ★ 3.0 | 95 | BULK-c6b81ab4 |
| 18284 | Bulk Product faf0511d | Home & Garden | $789.19 | 379 | ★ 1.9 | 70 | BULK-93f45906 |
| 18285 | Bulk Product 4df4dd4d | Clothing | $407.32 | 49 | ★ 3.2 | 29 | BULK-07f9f2c3 |
| 18286 | Bulk Product 493b5548 | Electronics | $994.42 | 242 | ★ 4.8 | 89 | BULK-6e888fd3 |
| 18287 | Bulk Product 713ab995 | Clothing | $62.59 | 419 | ★ 1.9 | 89 | BULK-cc11d8c2 |
| 18288 | Bulk Product abdff5f0 | Sports & Outdoors | $174.18 | 291 | ★ 0.2 | 98 | BULK-2ea34403 |
| 18289 | Bulk Product 0f9aeef6 | Toys & Games | $556.13 | 389 | ★ 3.6 | 46 | BULK-72fc05fc |
| 18290 | Bulk Product 2afe1e43 | Home & Garden | $203.13 | 209 | ★ 3.1 | 53 | BULK-dc2be9d0 |
| 18291 | Bulk Product a69e1dc1 | Books | $687.72 | 319 | ★ 0.0 | 67 | BULK-5bf9d6e6 |
| 18292 | Bulk Product 17ec4691 | Home & Garden | $595.38 | 125 | ★ 1.8 | 83 | BULK-b24d09bc |
| 18293 | Bulk Product 37921ac0 | Sports & Outdoors | $690.70 | 211 | ★ 3.2 | 40 | BULK-6e4c308f |
| 18294 | Bulk Product a943afeb | Clothing | $744.42 | 159 | ★ 1.0 | 34 | BULK-6b237165 |
| 18295 | Bulk Product 7e1a7186 | Books | $596.05 | 83 | ★ 1.9 | 44 | BULK-a88e2dd7 |
| 18296 | Bulk Product d5d151ec | Books | $92.53 | 468 | ★ 1.2 | 85 | BULK-49549c2e |
| 18297 | Bulk Product 9ba60c18 | Books | $745.37 | 460 | ★ 3.3 | 99 | BULK-a4706332 |
| 18298 | Bulk Product e542cbb2 | Toys & Games | $481.18 | 297 | ★ 3.0 | 91 | BULK-48ff3dc4 |
| 18299 | Bulk Product 1eb8db43 | Home & Garden | $65.15 | 129 | ★ 1.2 | 31 | BULK-54534776 |
| 18300 | Bulk Product b8c5192f | Sports & Outdoors | $421.40 | 197 | ★ 0.2 | 42 | BULK-4c8a64e1 |
| 18301 | Bulk Product 16f9d8c4 | Home & Garden | $285.98 | 488 | ★ 2.1 | 22 | BULK-3ff2343b |
| 18302 | Bulk Product 68034a86 | Electronics | $57.89 | 347 | ★ 0.7 | 85 | BULK-97cc9f09 |
| 18303 | Bulk Product 2ca4a5fb | Electronics | $227.56 | 477 | ★ 1.7 | 22 | BULK-8188de1a |
| 18304 | Bulk Product c321cbef | Electronics | $837.05 | 113 | ★ 3.9 | 84 | BULK-3deea1e0 |
| 18305 | Bulk Product 24df0e57 | Sports & Outdoors | $24.56 | 25 | ★ 1.4 | 27 | BULK-6fd3f138 |
| 18306 | Bulk Product 118d7d71 | Clothing | $342.04 | 279 | ★ 4.1 | 86 | BULK-330ea4a8 |
| 18307 | Bulk Product 0740c1b5 | Clothing | $819.43 | 110 | ★ 1.5 | 78 | BULK-96c916ad |
| 18308 | Bulk Product f2014996 | Clothing | $801.65 | 365 | ★ 2.3 | 63 | BULK-18f1b3a3 |
| 18309 | Bulk Product 8de1f29f | Books | $884.59 | 181 | ★ 0.9 | 45 | BULK-bd6a65a7 |
| 18310 | Bulk Product 45b24b97 | Clothing | $877.09 | 44 | ★ 4.5 | 13 | BULK-826418be |
| 18311 | Bulk Product 8242a9f1 | Home & Garden | $134.33 | 313 | ★ 1.3 | 72 | BULK-e734bef1 |
| 18312 | Bulk Product 975f33fc | Clothing | $970.21 | 186 | ★ 4.8 | 81 | BULK-e270baf1 |
| 18313 | Bulk Product 88ea75ac | Electronics | $839.42 | 73 | ★ 2.8 | 83 | BULK-0edd9c53 |
| 18314 | Bulk Product dd6f1077 | Sports & Outdoors | $374.32 | 253 | ★ 1.3 | 37 | BULK-b27fcc5b |
| 18315 | Bulk Product 1f3c0451 | Books | $1,002.85 | 192 | ★ 4.3 | 22 | BULK-8ef05f91 |
| 18316 | Bulk Product d1f2ad8b | Sports & Outdoors | $344.67 | 116 | ★ 4.4 | 35 | BULK-eb8c8160 |
| 18317 | Bulk Product 6d05b523 | Clothing | $380.20 | 400 | ★ 4.3 | 95 | BULK-7bcf7318 |
| 18318 | Bulk Product 5c010863 | Sports & Outdoors | $507.24 | 182 | ★ 3.2 | 90 | BULK-de522433 |
| 18319 | Bulk Product 7c24f506 | Sports & Outdoors | $335.53 | 57 | ★ 4.3 | 81 | BULK-74da9810 |
| 18320 | Bulk Product 6bace188 | Clothing | $639.64 | 27 | ★ 1.8 | 85 | BULK-21b8bbfa |
| 18321 | Bulk Product a2dca56d | Sports & Outdoors | $281.79 | 465 | ★ 3.3 | 68 | BULK-8d578f39 |
| 18322 | Bulk Product 96758fd5 | Home & Garden | $313.28 | 278 | ★ 1.5 | 56 | BULK-0daa8757 |
| 18323 | Bulk Product 084a2f85 | Sports & Outdoors | $725.65 | 441 | ★ 0.8 | 79 | BULK-122a7feb |
| 18324 | Bulk Product 4ffbeec1 | Home & Garden | $284.42 | 208 | ★ 3.5 | 29 | BULK-c43c0635 |
| 18325 | Bulk Product 237b4d34 | Books | $398.25 | 438 | ★ 2.5 | 11 | BULK-8f9d001d |
| 18326 | Bulk Product 47e4cf01 | Clothing | $791.85 | 70 | ★ 0.8 | 92 | BULK-f07c1fb6 |
| 18327 | Bulk Product eec6427a | Sports & Outdoors | $318.24 | 348 | ★ 4.9 | 29 | BULK-8941f9b8 |
| 18328 | Bulk Product df203639 | Clothing | $929.86 | 66 | ★ 0.6 | 31 | BULK-5bcdf2b0 |
| 18329 | Bulk Product 21e30b06 | Clothing | $979.10 | 479 | ★ 3.8 | 95 | BULK-c80acfde |
| 18330 | Bulk Product ced8ff05 | Home & Garden | $200.63 | 323 | ★ 0.7 | 41 | BULK-69c703d2 |
| 18331 | Bulk Product 5cb0c84c | Sports & Outdoors | $428.53 | 173 | ★ 4.0 | 5 | BULK-dbfaa50e |
| 18332 | Bulk Product e7af4085 | Electronics | $786.41 | 233 | ★ 0.5 | 75 | BULK-73cc3503 |
| 18333 | Bulk Product 63ea4492 | Sports & Outdoors | $108.35 | 453 | ★ 2.5 | 22 | BULK-cc374ef3 |
| 18334 | Bulk Product fb2b8dfa | Sports & Outdoors | $460.28 | 394 | ★ 0.0 | 74 | BULK-fc73d8ca |
| 18335 | Bulk Product 4eec4f18 | Books | $521.93 | 490 | ★ 0.7 | 87 | BULK-973dc08c |
| 18336 | Bulk Product a050b96a | Toys & Games | $548.59 | 297 | ★ 3.5 | 54 | BULK-f950c5dd |
| 18337 | Bulk Product 3ffb1ae5 | Books | $189.40 | 107 | ★ 0.5 | 32 | BULK-9f1ee792 |
| 18338 | Bulk Product 7781b4a1 | Home & Garden | $196.71 | 134 | ★ 4.3 | 44 | BULK-19f5b05a |
| 18339 | Bulk Product 6820f91d | Books | $690.34 | 337 | ★ 0.7 | 70 | BULK-13d46fa1 |
| 18340 | Bulk Product be7c4f06 | Books | $262.17 | 163 | ★ 0.9 | 94 | BULK-8f75f5b2 |
| 18341 | Bulk Product 8438ee8b | Clothing | $900.99 | 24 | ★ 1.1 | 31 | BULK-512565ba |
| 18342 | Bulk Product c4f0dec5 | Electronics | $581.52 | 241 | ★ 4.3 | 45 | BULK-7d4e64c6 |
| 18343 | Bulk Product 0e835dc2 | Toys & Games | $939.90 | 137 | ★ 4.1 | 48 | BULK-614bcdfa |
| 18344 | Bulk Product ae54af01 | Home & Garden | $29.50 | 129 | ★ 2.1 | 6 | BULK-8955a759 |
| 18345 | Bulk Product 65d76684 | Sports & Outdoors | $204.65 | 417 | ★ 2.1 | 5 | BULK-fb316180 |
| 18346 | Bulk Product 90802966 | Clothing | $945.06 | 159 | ★ 1.5 | 24 | BULK-54b68763 |
| 18347 | Bulk Product 220dc0ae | Sports & Outdoors | $602.69 | 5 | ★ 2.2 | 17 | BULK-1df153f7 |
| 18348 | Bulk Product 1fe65a9b | Books | $480.14 | 344 | ★ 4.9 | 11 | BULK-27490a79 |
| 18349 | Bulk Product faa3ae52 | Toys & Games | $871.74 | 335 | ★ 3.7 | 93 | BULK-955db7fd |
| 18350 | Bulk Product 7213df5d | Books | $638.38 | 413 | ★ 4.8 | 78 | BULK-ea49406d |
| 18351 | Bulk Product 695e1d45 | Electronics | $306.57 | 148 | ★ 0.6 | 22 | BULK-5ee9c631 |
| 18352 | Bulk Product d3f915b7 | Toys & Games | $90.18 | 381 | ★ 4.8 | 74 | BULK-920b6c49 |
| 18353 | Bulk Product d28f4a4b | Home & Garden | $568.74 | 223 | ★ 0.1 | 63 | BULK-3990ec29 |
| 18354 | Bulk Product b346ded8 | Home & Garden | $724.88 | 137 | ★ 4.9 | 54 | BULK-5edd9fb3 |
| 18355 | Bulk Product d05454b5 | Electronics | $543.75 | 279 | ★ 3.3 | 79 | BULK-a0e2c97c |
| 18356 | Bulk Product 244d34ea | Toys & Games | $1,005.40 | 24 | ★ 1.3 | 31 | BULK-7750ee61 |
| 18357 | Bulk Product aaaa8e17 | Sports & Outdoors | $345.34 | 337 | ★ 4.5 | 56 | BULK-12f57f9c |
| 18358 | Bulk Product 139aeb0b | Sports & Outdoors | $942.99 | 317 | ★ 3.2 | 30 | BULK-ccbeae56 |
| 18359 | Bulk Product 5cf0c781 | Home & Garden | $998.98 | 252 | ★ 0.6 | 90 | BULK-4087ae9f |
// 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
};
}