Efficient pagination using OFFSET-FETCH on SQL Server.
| ID | Name | Category | Price | Stock | Rating | Reviews | SKU |
|---|---|---|---|---|---|---|---|
| 14160 | Bulk Product 423e4660 | Home & Garden | $575.46 | 441 | ★ 1.1 | 22 | BULK-ca9d778c |
| 14161 | Bulk Product c9ee8800 | Clothing | $86.87 | 447 | ★ 0.2 | 77 | BULK-36be7a53 |
| 14162 | Bulk Product 1ecde961 | Sports & Outdoors | $469.18 | 289 | ★ 4.1 | 96 | BULK-16950ce6 |
| 14163 | Bulk Product 819f3f8e | Sports & Outdoors | $299.17 | 49 | ★ 5.0 | 24 | BULK-569b00ea |
| 14164 | Bulk Product e5d51a91 | Home & Garden | $343.31 | 8 | ★ 1.1 | 42 | BULK-8467ee14 |
| 14165 | Bulk Product 2b91af4f | Clothing | $240.54 | 140 | ★ 0.1 | 12 | BULK-39213905 |
| 14166 | Bulk Product 9b667205 | Sports & Outdoors | $908.17 | 121 | ★ 2.6 | 95 | BULK-3e018e62 |
| 14167 | Bulk Product e39e7923 | Clothing | $594.77 | 312 | ★ 0.7 | 51 | BULK-34aaeefe |
| 14168 | Bulk Product cbc20e8c | Clothing | $474.43 | 65 | ★ 1.7 | 67 | BULK-02cc5569 |
| 14169 | Bulk Product 8bec3998 | Sports & Outdoors | $997.64 | 456 | ★ 0.4 | 95 | BULK-41fa57e4 |
| 14170 | Bulk Product 8dbee59a | Sports & Outdoors | $482.51 | 64 | ★ 3.8 | 27 | BULK-b87c7bd6 |
| 14171 | Bulk Product 97f50580 | Electronics | $137.51 | 215 | ★ 2.1 | 53 | BULK-b6da96ef |
| 14172 | Bulk Product a864fdb0 | Electronics | $943.18 | 459 | ★ 1.4 | 27 | BULK-ff3d83b0 |
| 14173 | Bulk Product f9377bc2 | Home & Garden | $599.56 | 127 | ★ 0.0 | 90 | BULK-09e62235 |
| 14174 | Bulk Product 787ca5ff | Toys & Games | $865.81 | 472 | ★ 3.3 | 78 | BULK-2b6dd081 |
| 14175 | Bulk Product 57352bd8 | Electronics | $229.33 | 197 | ★ 0.8 | 69 | BULK-a3b7b2fc |
| 14176 | Bulk Product a2e06df8 | Toys & Games | $277.99 | 320 | ★ 1.0 | 89 | BULK-9c6e75f3 |
| 14177 | Bulk Product 853df818 | Electronics | $85.98 | 324 | ★ 1.6 | 27 | BULK-3bfbbe51 |
| 14178 | Bulk Product 2b6034ab | Home & Garden | $507.61 | 57 | ★ 2.9 | 87 | BULK-71ce7fe6 |
| 14179 | Bulk Product c85e7387 | Books | $535.66 | 443 | ★ 1.4 | 31 | BULK-ebd42d35 |
| 14180 | Bulk Product e705a3d4 | Books | $620.74 | 262 | ★ 0.0 | 13 | BULK-f5956aae |
| 14181 | Bulk Product 0692ff13 | Books | $391.47 | 474 | ★ 4.4 | 60 | BULK-94cb954c |
| 14182 | Bulk Product 500de276 | Toys & Games | $643.37 | 410 | ★ 3.9 | 14 | BULK-ff862caf |
| 14183 | Bulk Product cf7b7b30 | Toys & Games | $781.30 | 193 | ★ 1.0 | 82 | BULK-305a88f7 |
| 14184 | Bulk Product f2c8fd3f | Toys & Games | $450.06 | 25 | ★ 2.7 | 66 | BULK-7653ad8d |
| 14185 | Bulk Product 48469eb8 | Sports & Outdoors | $538.12 | 168 | ★ 4.6 | 1 | BULK-4e632561 |
| 14186 | Bulk Product 3a6fa98c | Clothing | $338.36 | 185 | ★ 3.3 | 47 | BULK-c0625bdf |
| 14187 | Bulk Product b418c0b4 | Electronics | $77.43 | 202 | ★ 4.7 | 5 | BULK-538f4d86 |
| 14188 | Bulk Product bda1819f | Electronics | $173.73 | 146 | ★ 1.6 | 53 | BULK-bc4158d9 |
| 14189 | Bulk Product aa1ed218 | Home & Garden | $509.21 | 245 | ★ 0.4 | 20 | BULK-6a73469e |
| 14190 | Bulk Product 8104dc25 | Clothing | $879.51 | 298 | ★ 2.9 | 99 | BULK-f40f4a8e |
| 14191 | Bulk Product b62bef11 | Books | $977.82 | 282 | ★ 1.0 | 87 | BULK-2258fd87 |
| 14192 | Bulk Product 216741ef | Toys & Games | $293.22 | 450 | ★ 3.5 | 57 | BULK-f7b502a3 |
| 14193 | Bulk Product dbb5cfc4 | Home & Garden | $760.99 | 31 | ★ 4.4 | 17 | BULK-718e3841 |
| 14194 | Bulk Product 090780d7 | Toys & Games | $814.68 | 382 | ★ 1.4 | 81 | BULK-ac8177cf |
| 14195 | Bulk Product d039379a | Books | $176.04 | 34 | ★ 2.4 | 45 | BULK-7649ff0a |
| 14196 | Bulk Product 1ac7c87a | Electronics | $41.54 | 12 | ★ 3.5 | 57 | BULK-c0d21f93 |
| 14197 | Bulk Product a9361940 | Books | $104.82 | 277 | ★ 1.3 | 85 | BULK-66b9695c |
| 14198 | Bulk Product e506e2d4 | Toys & Games | $853.55 | 61 | ★ 4.7 | 83 | BULK-b15fea98 |
| 14199 | Bulk Product 33f864d4 | Books | $143.30 | 122 | ★ 3.1 | 67 | BULK-188eb5a2 |
| 14200 | Bulk Product 4c0abeb8 | Electronics | $98.00 | 128 | ★ 5.0 | 22 | BULK-26840ffc |
| 14201 | Bulk Product 364def1d | Sports & Outdoors | $359.26 | 125 | ★ 3.7 | 28 | BULK-15a96a87 |
| 14202 | Bulk Product b5a82478 | Electronics | $253.56 | 489 | ★ 3.5 | 48 | BULK-3ea81645 |
| 14203 | Bulk Product 086ca0dd | Books | $769.80 | 7 | ★ 4.2 | 42 | BULK-7c36171c |
| 14204 | Bulk Product fced2f7b | Books | $353.13 | 19 | ★ 0.7 | 62 | BULK-f5a08a18 |
| 14205 | Bulk Product b7bef8cd | Toys & Games | $297.51 | 65 | ★ 4.6 | 66 | BULK-a4780f78 |
| 14206 | Bulk Product 108ede83 | Books | $443.83 | 492 | ★ 2.8 | 92 | BULK-9df800e8 |
| 14207 | Bulk Product 7f3a9525 | Home & Garden | $326.86 | 420 | ★ 0.0 | 83 | BULK-b9499eb8 |
| 14208 | Bulk Product 827c4ded | Sports & Outdoors | $331.30 | 65 | ★ 0.1 | 96 | BULK-842029e5 |
| 14209 | Bulk Product f8a4df47 | Home & Garden | $806.97 | 485 | ★ 4.3 | 96 | BULK-2ee8866e |
| 14210 | Bulk Product e979eec9 | Electronics | $950.02 | 328 | ★ 1.6 | 15 | BULK-edcfa7ca |
| 14211 | Bulk Product 68ca7c34 | Sports & Outdoors | $257.90 | 165 | ★ 2.4 | 29 | BULK-4616072d |
| 14212 | Bulk Product d6a16143 | Books | $109.10 | 489 | ★ 0.8 | 45 | BULK-d45ad925 |
| 14213 | Bulk Product 2af96c74 | Toys & Games | $277.62 | 464 | ★ 3.3 | 93 | BULK-f4aeb64f |
| 14214 | Bulk Product 5affb1e5 | Sports & Outdoors | $172.40 | 177 | ★ 3.9 | 1 | BULK-15b53a6d |
| 14215 | Bulk Product 802bd257 | Sports & Outdoors | $580.06 | 390 | ★ 4.8 | 88 | BULK-ea2b6ae7 |
| 14216 | Bulk Product 771bbd00 | Sports & Outdoors | $64.12 | 390 | ★ 1.2 | 45 | BULK-8601dbd0 |
| 14217 | Bulk Product d7de4b31 | Books | $296.15 | 3 | ★ 1.0 | 0 | BULK-365bf5aa |
| 14218 | Bulk Product 26e915c5 | Sports & Outdoors | $979.83 | 220 | ★ 1.9 | 37 | BULK-cb7bec29 |
| 14219 | Bulk Product 99a30912 | Home & Garden | $476.75 | 132 | ★ 3.3 | 46 | BULK-3496db06 |
| 14220 | Bulk Product 01797e64 | Electronics | $870.06 | 486 | ★ 1.3 | 73 | BULK-d17fa504 |
| 14221 | Bulk Product 44d57b67 | Electronics | $569.12 | 33 | ★ 3.1 | 40 | BULK-d365cc6a |
| 14222 | Bulk Product 2837c2a2 | Sports & Outdoors | $852.59 | 64 | ★ 2.8 | 54 | BULK-cb9070ef |
| 14223 | Bulk Product 630ffef7 | Home & Garden | $700.22 | 363 | ★ 0.6 | 14 | BULK-c395def3 |
| 14224 | Bulk Product 182c1bf7 | Books | $387.03 | 120 | ★ 4.0 | 49 | BULK-80014cf7 |
| 14225 | Bulk Product 6c9de133 | Home & Garden | $280.94 | 70 | ★ 4.1 | 26 | BULK-58887c71 |
| 14226 | Bulk Product b51016fe | Electronics | $858.03 | 258 | ★ 2.0 | 91 | BULK-22f103d7 |
| 14227 | Bulk Product 966e956d | Electronics | $346.91 | 171 | ★ 2.5 | 28 | BULK-6a3bdf2c |
| 14228 | Bulk Product 3bdf4b34 | Sports & Outdoors | $449.90 | 429 | ★ 3.7 | 87 | BULK-8f6bb2cc |
| 14229 | Bulk Product 039066af | Toys & Games | $135.99 | 240 | ★ 0.0 | 0 | BULK-fc3fe298 |
| 14230 | Bulk Product be4b1e63 | Clothing | $732.58 | 161 | ★ 3.9 | 48 | BULK-0439d532 |
| 14231 | Bulk Product 3c050d06 | Sports & Outdoors | $871.11 | 260 | ★ 1.5 | 12 | BULK-148fdd01 |
| 14232 | Bulk Product 53834e84 | Sports & Outdoors | $844.82 | 237 | ★ 3.9 | 34 | BULK-2336a3b1 |
| 14233 | Bulk Product c37af381 | Electronics | $706.47 | 150 | ★ 0.9 | 87 | BULK-e6c7ffed |
| 14234 | Bulk Product 8d017d27 | Clothing | $23.49 | 457 | ★ 4.8 | 76 | BULK-3445a2a8 |
| 14235 | Bulk Product ff69ec79 | Sports & Outdoors | $1,004.25 | 192 | ★ 2.3 | 39 | BULK-c6354484 |
| 14236 | Bulk Product 4f978dc1 | Electronics | $413.53 | 73 | ★ 1.1 | 47 | BULK-2786d6ad |
| 14237 | Bulk Product a3d0fab2 | Toys & Games | $998.50 | 17 | ★ 1.2 | 44 | BULK-121abe5c |
| 14238 | Bulk Product 85e20efd | Toys & Games | $196.46 | 146 | ★ 4.4 | 14 | BULK-fd444a08 |
| 14239 | Bulk Product fa6e8c62 | Electronics | $112.35 | 79 | ★ 2.9 | 92 | BULK-2b2d70ae |
| 14240 | Bulk Product 4073b5c8 | Toys & Games | $934.81 | 242 | ★ 2.4 | 93 | BULK-8d346dd3 |
| 14241 | Bulk Product 783b1830 | Toys & Games | $839.94 | 181 | ★ 0.4 | 82 | BULK-8841ecbc |
| 14242 | Bulk Product 25c9f2fc | Clothing | $686.34 | 109 | ★ 4.8 | 73 | BULK-d3f6f6ff |
| 14243 | Bulk Product 0e926406 | Books | $591.89 | 449 | ★ 3.2 | 17 | BULK-9c13a3c7 |
| 14244 | Bulk Product 1845f40e | Home & Garden | $328.57 | 246 | ★ 0.5 | 67 | BULK-e169d4d3 |
| 14245 | Bulk Product fa134795 | Electronics | $845.51 | 411 | ★ 4.4 | 20 | BULK-0f279a44 |
| 14246 | Bulk Product cacc3eed | Books | $285.00 | 296 | ★ 0.2 | 39 | BULK-fb18e2ab |
| 14247 | Bulk Product b7128e17 | Clothing | $330.71 | 337 | ★ 1.5 | 96 | BULK-1b92a1bf |
| 14248 | Bulk Product 53a3e88c | Electronics | $178.06 | 138 | ★ 3.2 | 94 | BULK-9efa926a |
| 14249 | Bulk Product fabbd170 | Home & Garden | $871.54 | 379 | ★ 2.4 | 7 | BULK-1f7d89fc |
| 14250 | Bulk Product a30ae9dd | Toys & Games | $470.52 | 8 | ★ 2.9 | 54 | BULK-c20b806d |
| 14251 | Bulk Product 6bcc95f3 | Clothing | $60.09 | 37 | ★ 4.6 | 22 | BULK-893620ae |
| 14252 | Bulk Product d97987ea | Toys & Games | $753.00 | 475 | ★ 1.6 | 52 | BULK-48ff3f54 |
| 14253 | Bulk Product 6205c0da | Sports & Outdoors | $253.76 | 341 | ★ 2.6 | 66 | BULK-6a09e22a |
| 14254 | Bulk Product 1741a4fd | Electronics | $408.86 | 464 | ★ 2.7 | 63 | BULK-85104e49 |
| 14255 | Bulk Product 37941382 | Home & Garden | $283.30 | 21 | ★ 0.4 | 79 | BULK-c99f10dd |
| 14256 | Bulk Product de943bbd | Clothing | $384.57 | 339 | ★ 4.7 | 49 | BULK-1e17177e |
| 14257 | Bulk Product 9bb8f3f1 | Books | $847.42 | 204 | ★ 1.9 | 93 | BULK-013ce714 |
| 14258 | Bulk Product d10eaaca | Clothing | $891.42 | 186 | ★ 1.2 | 75 | BULK-e5bd4f25 |
| 14259 | Bulk Product 0ea00f5a | Clothing | $596.14 | 260 | ★ 2.4 | 25 | BULK-ca56efac |
// 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
};
}