Efficient Pagination with Skip/Take

Efficient pagination using OFFSET-FETCH on SQL Server.

Execution Time

27 ms

Page Size

100

Current Page

214 / 245

Total Records

24441

Items per page: 25 50 100 200

Page 214 Results Showing 21301 - 21400 of 24441

ID Name Category Price Stock Rating Reviews SKU
21860 Bulk Product 73f2e5c3 Clothing $505.65 87 3.6 81 BULK-95e08792
21861 Bulk Product 2be860d0 Home & Garden $787.02 24 1.1 63 BULK-455d2d8b
21862 Bulk Product 67fac2a7 Books $798.30 313 2.4 37 BULK-90327b4b
21863 Bulk Product 2f8e624f Toys & Games $907.21 248 3.0 39 BULK-52bb2a18
21864 Bulk Product beb58275 Clothing $223.16 498 1.5 3 BULK-8e63441e
21865 Bulk Product fd1a7e14 Clothing $634.41 90 0.7 12 BULK-ae6a72e8
21866 Bulk Product f48095bf Books $373.57 237 1.8 53 BULK-3de5a521
21867 Bulk Product ff6a4a9f Toys & Games $967.43 47 0.6 25 BULK-f7fe882a
21868 Bulk Product 0ceb1c02 Books $904.67 205 2.9 7 BULK-5e80265b
21869 Bulk Product e450eb90 Books $498.80 377 4.0 81 BULK-7d0b509e
21870 Bulk Product 06a3adce Sports & Outdoors $158.13 302 2.7 72 BULK-121e250b
21871 Bulk Product 88c06253 Books $334.79 139 2.1 97 BULK-a759a629
21872 Bulk Product fad15c42 Clothing $743.33 333 1.5 19 BULK-8930218e
21873 Bulk Product 701bab67 Books $157.88 346 1.0 34 BULK-4079a905
21874 Bulk Product f8653464 Sports & Outdoors $822.94 490 4.1 23 BULK-cc0450d5
21875 Bulk Product c0080e90 Clothing $193.17 76 1.5 15 BULK-9128014b
21876 Bulk Product f2251685 Electronics $376.60 295 1.4 47 BULK-e84b8b13
21877 Bulk Product b872b221 Toys & Games $306.26 407 1.7 90 BULK-782e9e0e
21878 Bulk Product 9ea5dadd Sports & Outdoors $954.19 488 0.3 5 BULK-04baebf6
21879 Bulk Product 28cb7a4f Home & Garden $831.11 470 5.0 84 BULK-da4a8b49
21880 Bulk Product 1b607bcf Books $784.75 96 4.0 74 BULK-5f7ed500
21881 Bulk Product 709a581a Books $173.63 198 0.9 40 BULK-53c43bb8
21882 Bulk Product 4cfc2b26 Toys & Games $273.38 355 3.0 15 BULK-8cecd43e
21883 Bulk Product e07f9026 Sports & Outdoors $102.00 2 3.0 85 BULK-2419cc8e
21884 Bulk Product 25dbfd17 Sports & Outdoors $809.86 151 3.9 65 BULK-1cf22485
21885 Bulk Product f8dcb9d3 Books $852.52 353 0.9 13 BULK-b7bde4e8
21886 Bulk Product 1ddbc4e3 Clothing $1,007.12 38 1.4 68 BULK-4cc598fc
21887 Bulk Product 5df5e20a Books $938.89 227 1.4 79 BULK-646164b9
21888 Bulk Product 67805143 Books $411.46 367 4.7 49 BULK-a59139a6
21889 Bulk Product 9c90305b Toys & Games $973.45 324 0.5 17 BULK-51f5a803
21890 Bulk Product e1837a6b Toys & Games $197.51 492 2.8 83 BULK-055ec6b6
21891 Bulk Product 9ff6720a Sports & Outdoors $925.46 271 2.2 98 BULK-30f5cac0
21892 Bulk Product cbd6c15a Sports & Outdoors $985.49 341 4.5 20 BULK-87396aa6
21893 Bulk Product d437db45 Toys & Games $1,002.09 315 2.6 42 BULK-a902f993
21894 Bulk Product 00264272 Sports & Outdoors $258.16 221 1.4 83 BULK-6f05d6bd
21895 Bulk Product 3b0bf6c2 Clothing $140.82 231 2.9 25 BULK-a2994bac
21896 Bulk Product b2c92560 Sports & Outdoors $504.51 387 1.9 17 BULK-cb0faa9a
21897 Bulk Product dbe0340f Toys & Games $176.57 23 0.0 3 BULK-ff0e178a
21898 Bulk Product f3bada2d Books $107.79 309 3.3 73 BULK-70ebe7eb
21899 Bulk Product 722063ef Books $312.78 469 4.4 15 BULK-714b995e
21900 Bulk Product 0748d381 Sports & Outdoors $413.49 376 3.4 25 BULK-fbee13cf
21901 Bulk Product 8cec9cbc Electronics $647.37 80 2.3 6 BULK-6df401d3
21902 Bulk Product e7e0c7b8 Clothing $84.39 259 2.4 54 BULK-abf7a8f4
21903 Bulk Product e5093aa4 Sports & Outdoors $459.59 246 1.9 0 BULK-9706e80f
21904 Bulk Product ee6cc8c1 Clothing $213.45 135 1.5 29 BULK-e3ca9322
21905 Bulk Product c01cb66d Toys & Games $871.66 473 2.2 78 BULK-6cd27bc9
21906 Bulk Product 34fe20dc Books $344.94 469 1.8 38 BULK-4a69a714
21907 Bulk Product 1f75d1e7 Clothing $743.16 307 3.3 96 BULK-9494ad75
21908 Bulk Product c9f7aab1 Clothing $617.68 123 2.4 42 BULK-866f47a4
21909 Bulk Product d8e8984a Electronics $104.59 456 2.9 30 BULK-11dc55af
21910 Bulk Product be76c595 Sports & Outdoors $827.71 270 2.8 56 BULK-3abbea8e
21911 Bulk Product 2efd8742 Clothing $388.26 370 2.6 88 BULK-59aadf89
21912 Bulk Product c45d984b Toys & Games $489.87 296 2.9 38 BULK-f1d73134
21913 Bulk Product bfaaf3ff Toys & Games $567.00 66 2.0 81 BULK-36564cfb
21914 Bulk Product 15332c43 Electronics $116.59 346 1.1 91 BULK-42556a02
21915 Bulk Product 66593730 Sports & Outdoors $930.99 338 2.6 25 BULK-ace3a94b
21916 Bulk Product e3fd5b46 Toys & Games $393.45 72 1.7 40 BULK-1ee353a7
21917 Bulk Product a5851116 Electronics $652.79 426 1.0 23 BULK-fa688dc2
21918 Bulk Product 471c1387 Sports & Outdoors $156.59 436 0.4 40 BULK-1d4034c1
21919 Bulk Product 8ad9039f Clothing $649.75 479 3.3 49 BULK-14c156ab
21920 Bulk Product 4af8c52d Toys & Games $249.55 176 3.3 27 BULK-73cb2f4f
21921 Bulk Product 3080894d Toys & Games $766.22 46 1.4 60 BULK-0c0c64d7
21922 Bulk Product 09159d3d Toys & Games $451.46 333 1.7 59 BULK-74c7c1d0
21923 Bulk Product e9e87229 Books $346.89 395 0.5 56 BULK-3b5169dd
21924 Bulk Product c7a3d77a Sports & Outdoors $380.31 404 1.4 79 BULK-5881d0d0
21925 Bulk Product 27ee31c2 Clothing $82.16 401 4.9 1 BULK-59cba654
21926 Bulk Product 076fa462 Electronics $939.08 51 2.1 8 BULK-fb6c5852
21927 Bulk Product 82e05901 Books $630.76 340 2.2 58 BULK-d7d7356f
21928 Bulk Product f7e9cabc Clothing $411.12 227 4.3 89 BULK-28cbca85
21929 Bulk Product 2ca24dc1 Home & Garden $378.68 247 3.0 46 BULK-acb65c9a
21930 Bulk Product ff4ac5aa Toys & Games $927.00 407 0.9 99 BULK-671ad74f
21931 Bulk Product 69e1e5e1 Home & Garden $653.44 401 1.8 64 BULK-bd17db69
21932 Bulk Product 6afb6612 Toys & Games $454.03 446 0.2 77 BULK-99c3136b
21933 Bulk Product 761de609 Sports & Outdoors $255.96 99 4.2 18 BULK-5f9bbf0b
21934 Bulk Product 9722224a Books $514.88 10 0.1 29 BULK-95f528e8
21935 Bulk Product f6847875 Toys & Games $138.27 432 4.2 88 BULK-859ef5f8
21936 Bulk Product b8f6482c Electronics $814.45 13 0.7 44 BULK-6df94678
21937 Bulk Product 80a9c83d Sports & Outdoors $39.16 286 2.6 40 BULK-903a659b
21938 Bulk Product 6523771f Books $922.83 108 2.1 32 BULK-c045f08b
21939 Bulk Product dbbd2962 Sports & Outdoors $615.38 452 0.1 67 BULK-0273eeba
21940 Bulk Product 7e791298 Home & Garden $627.54 215 4.8 35 BULK-e7238f18
21941 Bulk Product 65eb0b8d Clothing $405.55 389 4.4 14 BULK-fb7d4cf7
21942 Bulk Product 710cfdf5 Toys & Games $871.50 125 0.4 32 BULK-83280812
21943 Bulk Product f5918a4c Home & Garden $465.64 410 0.0 21 BULK-174b5146
21944 Bulk Product f6a78d21 Electronics $717.17 43 3.4 83 BULK-90fc48a2
21945 Bulk Product e647b380 Toys & Games $318.81 226 2.5 76 BULK-89ada1e0
21946 Bulk Product 9d658e3f Clothing $575.41 265 3.2 56 BULK-ec045e52
21947 Bulk Product 675a3700 Electronics $829.19 72 4.6 78 BULK-9ffcf69d
21948 Bulk Product 5b85c54c Clothing $491.61 50 3.8 19 BULK-bd241152
21949 Bulk Product a46f9053 Sports & Outdoors $613.96 322 3.9 5 BULK-c87b0ee1
21950 Bulk Product 5f82b64a Home & Garden $923.56 322 1.9 14 BULK-ed91db21
21951 Bulk Product c58e8af5 Clothing $740.67 106 2.6 40 BULK-895c6a10
21952 Bulk Product ae4166cd Toys & Games $463.43 460 3.3 77 BULK-609d5158
21953 Bulk Product ae8e5c9c Clothing $288.52 241 3.8 99 BULK-d35997a4
21954 Bulk Product 576a707d Toys & Games $739.66 360 4.7 33 BULK-728e2122
21955 Bulk Product 02de0b17 Home & Garden $570.82 444 1.0 13 BULK-b6c6c911
21956 Bulk Product 06b8ebb0 Toys & Games $94.51 275 0.7 14 BULK-c51e2de3
21957 Bulk Product 05d719db Books $703.41 396 4.3 64 BULK-7be05b83
21958 Bulk Product c3775751 Books $510.13 112 4.5 11 BULK-9dd4e5b5
21959 Bulk Product d2716ab6 Toys & Games $312.49 220 1.0 37 BULK-8811c598
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