Efficient Pagination with Skip/Take

Efficient pagination using OFFSET-FETCH on SQL Server.

Execution Time

16 ms

Page Size

100

Current Page

147 / 245

Total Records

24441

Items per page: 25 50 100 200

Page 147 Results Showing 14601 - 14700 of 24441

ID Name Category Price Stock Rating Reviews SKU
15160 Bulk Product 594bb818 Toys & Games $970.12 420 1.1 9 BULK-e5aa92a4
15161 Bulk Product 78cdbf5b Clothing $528.91 38 0.8 31 BULK-44718f80
15162 Bulk Product a39d402f Electronics $178.96 417 4.0 68 BULK-c5b7c197
15163 Bulk Product ed65c5f0 Books $84.57 468 1.3 6 BULK-752d638a
15164 Bulk Product b2a437e6 Electronics $945.14 219 3.3 71 BULK-6a630476
15165 Bulk Product 1aa42d4e Toys & Games $462.17 206 3.2 52 BULK-359e5632
15166 Bulk Product 5f6451e1 Home & Garden $267.45 311 2.5 58 BULK-6027ce20
15167 Bulk Product 1c18b70d Toys & Games $412.41 83 4.6 0 BULK-66125dd8
15168 Bulk Product f517840b Electronics $728.78 101 0.7 20 BULK-b3dced10
15169 Bulk Product f3c14080 Clothing $39.24 158 1.9 11 BULK-5bca717a
15170 Bulk Product 93e5f0e6 Clothing $97.12 29 2.4 94 BULK-524f0883
15171 Bulk Product 48232f94 Toys & Games $517.14 418 3.2 93 BULK-19451ccf
15172 Bulk Product 36cee84a Toys & Games $42.74 237 3.0 46 BULK-72287b55
15173 Bulk Product adf94e3a Books $766.85 427 2.6 90 BULK-9e7985f2
15174 Bulk Product 5787c46e Home & Garden $442.44 377 2.9 52 BULK-04a11f95
15175 Bulk Product 926163cb Electronics $78.85 319 2.3 80 BULK-f7960967
15176 Bulk Product 52bd86c8 Electronics $995.74 364 2.4 73 BULK-64dcc896
15177 Bulk Product ba4dbeb9 Clothing $946.90 496 3.3 12 BULK-5f7b0af9
15178 Bulk Product 8fcb8054 Home & Garden $172.37 33 2.9 57 BULK-3cbbc1ac
15179 Bulk Product 956c3406 Electronics $964.91 109 4.3 81 BULK-b1579eb0
15180 Bulk Product bd61ad33 Clothing $911.23 338 0.4 28 BULK-2855ddfa
15181 Bulk Product fed8dc47 Sports & Outdoors $288.62 278 2.8 11 BULK-55b342f4
15182 Bulk Product 6293783f Sports & Outdoors $886.76 347 3.2 59 BULK-758abde1
15183 Bulk Product d9c4018c Books $93.33 44 2.5 24 BULK-fd82041f
15184 Bulk Product 5140f825 Toys & Games $846.47 409 2.8 86 BULK-70257014
15185 Bulk Product ed97ad07 Home & Garden $806.64 286 4.4 83 BULK-d143ec69
15186 Bulk Product 13b4a7d7 Electronics $386.46 124 1.1 2 BULK-750adafd
15187 Bulk Product 863bf04c Books $463.26 498 3.5 86 BULK-51d37477
15188 Bulk Product d9eb0054 Home & Garden $574.77 16 0.3 71 BULK-d70aa196
15189 Bulk Product 9045cd10 Clothing $693.74 291 4.3 91 BULK-7118fac5
15190 Bulk Product 13dd6ee8 Toys & Games $213.45 21 1.0 29 BULK-44ac589f
15191 Bulk Product d02e3310 Clothing $541.70 179 4.7 14 BULK-0cd6f996
15192 Bulk Product ef11f1b7 Clothing $254.41 153 4.4 99 BULK-f4151ca8
15193 Bulk Product 210e8b3a Sports & Outdoors $140.80 486 0.3 49 BULK-aa67bf98
15194 Bulk Product b332c9eb Toys & Games $750.84 215 0.9 88 BULK-fd374d82
15195 Bulk Product 293ed38c Sports & Outdoors $617.58 488 4.5 42 BULK-7af6557c
15196 Bulk Product 7bc5745b Toys & Games $594.51 486 3.6 32 BULK-8fed494d
15197 Bulk Product 471191e8 Electronics $941.34 460 0.5 65 BULK-bf7763dd
15198 Bulk Product 3b93f20e Home & Garden $519.33 438 0.6 26 BULK-47e9a0a1
15199 Bulk Product a9377909 Electronics $577.24 490 1.0 23 BULK-0af8bb04
15200 Bulk Product 76a79166 Home & Garden $70.25 328 1.3 65 BULK-b3597208
15201 Bulk Product 94d8d473 Home & Garden $224.88 33 2.0 28 BULK-be4cd495
15202 Bulk Product 9cb78823 Electronics $288.30 403 0.2 30 BULK-dfc7cf23
15203 Bulk Product d86e5aac Sports & Outdoors $962.27 318 1.1 85 BULK-463ef150
15204 Bulk Product a62d5793 Toys & Games $578.24 187 0.1 3 BULK-1a922c0c
15205 Bulk Product fcec15ef Toys & Games $443.06 329 3.3 54 BULK-e26c0280
15206 Bulk Product f10f79f7 Toys & Games $414.39 164 4.2 80 BULK-77551a95
15207 Bulk Product 3eb69c11 Clothing $226.48 462 0.6 98 BULK-6ac924ae
15208 Bulk Product 5818ca4d Clothing $396.01 296 3.4 96 BULK-412c4663
15209 Bulk Product a75ffe73 Books $725.15 302 1.7 12 BULK-d20eb7cd
15210 Bulk Product f1bd847b Toys & Games $448.60 346 0.2 3 BULK-4a89a3b6
15211 Bulk Product 8195b366 Toys & Games $182.60 341 1.2 30 BULK-536f63e3
15212 Bulk Product 3221871f Electronics $107.41 277 4.7 36 BULK-07ebc2db
15213 Bulk Product 00b3909e Home & Garden $897.66 316 2.1 5 BULK-49efd8bc
15214 Bulk Product 3c458bbf Home & Garden $956.62 165 3.6 71 BULK-7a7a2949
15215 Bulk Product 762aa9d3 Home & Garden $897.59 225 0.7 50 BULK-bc627f4f
15216 Bulk Product 47bbf8de Sports & Outdoors $397.47 290 3.9 54 BULK-29c1ee61
15217 Bulk Product 3808980e Electronics $569.01 5 3.3 90 BULK-ec4f0f8e
15218 Bulk Product 7f99520a Toys & Games $790.23 440 1.0 20 BULK-6d04bc12
15219 Bulk Product 850f4488 Toys & Games $261.66 77 4.5 16 BULK-1004b136
15220 Bulk Product ed7d4edf Clothing $561.70 317 1.5 8 BULK-70017955
15221 Bulk Product e8bc18e4 Electronics $270.50 191 4.0 80 BULK-41a5c65a
15222 Bulk Product 4d3807f7 Toys & Games $868.11 107 2.8 30 BULK-9aa09d99
15223 Bulk Product 3bf5b4a0 Clothing $807.68 132 2.1 5 BULK-dc79b8a0
15224 Bulk Product c9966b93 Sports & Outdoors $773.80 410 0.2 48 BULK-56bb7b08
15225 Bulk Product dc614582 Clothing $873.07 116 2.7 2 BULK-e3d8efee
15226 Bulk Product be2f8072 Sports & Outdoors $965.95 417 4.0 40 BULK-979c193b
15227 Bulk Product 0b094283 Electronics $203.20 494 1.1 93 BULK-4c08a294
15228 Bulk Product 41b8a13a Clothing $11.06 199 1.4 53 BULK-807ed53b
15229 Bulk Product 2e40acf4 Electronics $933.42 210 0.5 64 BULK-23e47e18
15230 Bulk Product 5a4ce5de Home & Garden $884.04 460 2.7 63 BULK-b8c253d5
15231 Bulk Product 2710e959 Toys & Games $993.67 405 4.3 24 BULK-0d404b96
15232 Bulk Product 553b7059 Electronics $505.58 459 1.3 35 BULK-c2420393
15233 Bulk Product 95122b33 Toys & Games $118.48 16 2.2 74 BULK-3e65128a
15234 Bulk Product 24658c2f Clothing $997.22 266 1.7 41 BULK-64585c4e
15235 Bulk Product ec60c44c Clothing $654.59 271 2.3 40 BULK-c08ec34a
15236 Bulk Product 051d30c2 Books $859.16 242 1.9 97 BULK-fc1a74b6
15237 Bulk Product e5ea121f Books $312.01 142 3.0 62 BULK-b260f36b
15238 Bulk Product 9bfff0f7 Toys & Games $143.36 463 3.6 96 BULK-76a9ea40
15239 Bulk Product bcddc142 Clothing $228.13 259 2.9 89 BULK-c638efe1
15240 Bulk Product 7d33e287 Books $174.47 403 4.2 90 BULK-8708fd8b
15241 Bulk Product 7525b6d8 Sports & Outdoors $187.17 294 3.0 12 BULK-98672f5a
15242 Bulk Product e630df6e Sports & Outdoors $465.42 66 4.0 12 BULK-52fc4df5
15243 Bulk Product 66d68c1c Clothing $77.43 385 2.7 13 BULK-4eb42c19
15244 Bulk Product 7ebae1f5 Home & Garden $382.47 230 4.3 38 BULK-f0e5c497
15245 Bulk Product 62d5ab1a Toys & Games $386.01 495 0.6 91 BULK-deee7b73
15246 Bulk Product c33c7e4a Electronics $846.45 52 0.6 40 BULK-12f57e4f
15247 Bulk Product 0e3b6e77 Clothing $850.51 230 1.1 16 BULK-76e3afdd
15248 Bulk Product 914b69e5 Clothing $528.85 183 2.2 23 BULK-30312bcb
15249 Bulk Product b41e4744 Books $429.31 146 2.1 95 BULK-fb4597bc
15250 Bulk Product 7a9c13de Books $346.87 191 3.8 28 BULK-fc263c2e
15251 Bulk Product 492962f2 Sports & Outdoors $871.71 485 4.8 58 BULK-bc647fb1
15252 Bulk Product 5f86a8b2 Toys & Games $498.53 59 4.7 74 BULK-7e7ac5e9
15253 Bulk Product 1f680562 Toys & Games $177.01 429 4.3 19 BULK-3ae77fa0
15254 Bulk Product 85261cd2 Toys & Games $798.88 131 0.6 61 BULK-d94400d1
15255 Bulk Product c484e30e Toys & Games $320.68 119 0.3 98 BULK-00f85356
15256 Bulk Product 520c1a7c Toys & Games $318.92 389 4.8 69 BULK-938b59cc
15257 Bulk Product a541f8f4 Sports & Outdoors $335.93 133 4.3 2 BULK-1151670b
15258 Bulk Product 4de4e597 Sports & Outdoors $106.95 243 2.1 63 BULK-7ff386f6
15259 Bulk Product 920fcc5c Clothing $340.53 403 4.7 75 BULK-d3a7b2cd
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