Efficient Pagination with Skip/Take

Efficient pagination using OFFSET-FETCH on SQL Server.

Execution Time

7 ms

Page Size

200

Current Page

1 / 123

Total Records

24441

Items per page: 25 50 100 200

Page 1 Results Showing 1 - 200 of 24441

ID Name Category Price Stock Rating Reviews SKU
1 Professional Books Product XL Books $300.20 159 1.4 597 SKU-000001
3 Mega Home & Garden Product Lite Home & Garden $745.30 237 2.4 931 SKU-000003
4 Super Home & Garden Product Lite Home & Garden $566.14 305 1.9 762 SKU-000004
5 Economy Sports & Outdoors Product 2024 Sports & Outdoors $454.59 58 4.9 875 SKU-000005
6 Ultra Office Supplies Product Classic Office Supplies $680.12 65 4.8 458 SKU-000006
7 Premium Food & Grocery Product Plus Food & Grocery $893.65 58 4.5 692 SKU-000007
8 Premium Toys & Games Product Advanced Toys & Games $777.64 269 3.0 20 SKU-000008
9 Elite Office Supplies Product XL Office Supplies $524.92 447 1.1 813 SKU-000009
10 Premium Sports & Outdoors Product Mini Sports & Outdoors $194.23 440 2.5 512 SKU-000010
11 Super Automotive Product Plus Automotive $131.31 174 2.1 182 SKU-000011
12 Super Home & Garden Product Pro Home & Garden $457.54 211 4.3 283 SKU-000012
13 Premium Home & Garden Product Special Edition Home & Garden $63.63 356 5.0 487 SKU-000013
14 Economy Food & Grocery Product Lite Food & Grocery $837.73 156 2.0 775 SKU-000014
15 Mega Toys & Games Product Advanced Toys & Games $920.27 487 5.0 840 SKU-000015
17 Standard Books Product Mini Books $775.00 108 1.4 264 SKU-000017
18 Pro Sports & Outdoors Product Max Sports & Outdoors $218.35 248 2.7 370 SKU-000018
19 Economy Office Supplies Product 2024 Office Supplies $619.90 158 4.0 481 SKU-000019
20 Mega Health & Beauty Product Advanced Health & Beauty $378.20 25 4.8 610 SKU-000020
21 Ultra Sports & Outdoors Product Max Sports & Outdoors $458.74 188 1.8 477 SKU-000021
22 Professional Toys & Games Product Special Edition Toys & Games $555.99 272 1.0 524 SKU-000022
24 Mega Books Product Plus Books $97.64 83 1.4 673 SKU-000024
25 Super Clothing Product XL Clothing $607.42 230 4.1 797 SKU-000025
26 Ultra Sports & Outdoors Product Advanced Sports & Outdoors $58.41 88 3.8 618 SKU-000026
27 Professional Health & Beauty Product Advanced Health & Beauty $577.82 244 4.7 853 SKU-000027
28 Mega Automotive Product Mini Automotive $199.65 251 2.2 890 SKU-000028
29 Elite Sports & Outdoors Product 2024 Sports & Outdoors $148.04 128 2.7 602 SKU-000029
30 Premium Electronics Product Pro Electronics $100.96 435 2.2 553 SKU-000030
31 Mega Clothing Product 2024 Clothing $115.74 458 4.8 163 SKU-000031
32 Pro Health & Beauty Product Classic Health & Beauty $996.94 321 2.1 405 SKU-000032
33 Pro Sports & Outdoors Product Advanced Sports & Outdoors $736.58 432 4.6 304 SKU-000033
34 Deluxe Books Product Pro Books $656.69 40 2.9 600 SKU-000034
35 Ultra Sports & Outdoors Product XL Sports & Outdoors $976.95 253 1.4 744 SKU-000035
36 Mega Books Product Advanced Books $972.71 135 2.6 970 SKU-000036
37 Standard Home & Garden Product Advanced Home & Garden $753.83 219 2.4 911 SKU-000037
38 Ultra Sports & Outdoors Product XL Sports & Outdoors $854.28 377 4.0 463 SKU-000038
39 Premium Office Supplies Product Special Edition Office Supplies $416.94 389 3.0 671 SKU-000039
40 Mega Food & Grocery Product Max Food & Grocery $783.32 334 1.5 411 SKU-000040
41 Super Automotive Product Advanced Automotive $386.05 167 2.3 737 SKU-000041
43 Ultra Sports & Outdoors Product Mini Sports & Outdoors $537.08 121 2.7 151 SKU-000043
44 Standard Health & Beauty Product Max Health & Beauty $918.69 399 4.2 798 SKU-000044
45 Ultra Home & Garden Product Special Edition Home & Garden $384.17 85 2.5 213 SKU-000045
46 Premium Sports & Outdoors Product 2024 Sports & Outdoors $727.36 3 3.6 769 SKU-000046
47 Deluxe Automotive Product Special Edition Automotive $252.24 430 2.4 761 SKU-000047
48 Elite Clothing Product Max Clothing $517.25 321 1.4 799 SKU-000048
49 Professional Electronics Product XL Electronics $186.36 322 2.2 667 SKU-000049
50 Ultra Sports & Outdoors Product Max Sports & Outdoors $155.47 101 1.8 487 SKU-000050
52 Economy Home & Garden Product 2024 Home & Garden $537.02 413 4.6 611 SKU-000052
53 Standard Electronics Product XL Electronics $469.07 43 4.0 613 SKU-000053
54 Economy Sports & Outdoors Product XL Sports & Outdoors $803.02 470 2.7 437 SKU-000054
56 Super Automotive Product Pro Automotive $432.23 181 2.1 516 SKU-000056
57 Premium Office Supplies Product Classic Office Supplies $657.88 268 4.3 521 SKU-000057
58 Pro Toys & Games Product Max Toys & Games $182.95 238 2.6 552 SKU-000058
59 Elite Home & Garden Product 2024 Home & Garden $777.88 400 3.6 813 SKU-000059
60 Standard Automotive Product Classic Automotive $161.46 112 3.3 374 SKU-000060
61 Economy Automotive Product Pro Automotive $307.55 356 4.3 19 SKU-000061
62 Ultra Clothing Product XL Clothing $811.94 15 2.4 350 SKU-000062
63 Pro Health & Beauty Product Classic Health & Beauty $384.62 90 4.8 880 SKU-000063
64 Super Food & Grocery Product Plus Food & Grocery $711.82 104 2.8 948 SKU-000064
66 Mega Toys & Games Product XL Toys & Games $715.54 94 4.1 60 SKU-000066
67 Professional Clothing Product Pro Clothing $241.55 50 4.2 628 SKU-000067
68 Elite Sports & Outdoors Product 2024 Sports & Outdoors $270.51 300 2.9 614 SKU-000068
69 Elite Automotive Product Advanced Automotive $373.70 246 3.1 427 SKU-000069
70 Super Office Supplies Product Plus Office Supplies $616.89 80 4.1 990 SKU-000070
71 Mega Books Product Plus Books $818.77 6 3.8 712 SKU-000071
72 Pro Food & Grocery Product Mini Food & Grocery $763.67 406 4.4 974 SKU-000072
73 Standard Automotive Product Lite Automotive $490.99 324 2.8 672 SKU-000073
74 Mega Toys & Games Product Mini Toys & Games $893.26 335 1.7 773 SKU-000074
75 Economy Automotive Product Max Automotive $827.71 432 4.9 681 SKU-000075
77 Economy Toys & Games Product Special Edition Toys & Games $600.74 193 4.9 315 SKU-000077
78 Deluxe Office Supplies Product XL Office Supplies $953.02 248 3.6 299 SKU-000078
79 Deluxe Books Product Mini Books $864.07 332 2.9 763 SKU-000079
81 Ultra Food & Grocery Product Max Food & Grocery $961.23 67 3.3 743 SKU-000081
82 Super Food & Grocery Product XL Food & Grocery $825.65 349 4.2 639 SKU-000082
83 Professional Books Product Special Edition Books $205.90 194 4.5 209 SKU-000083
84 Ultra Office Supplies Product 2024 Office Supplies $889.42 498 3.4 100 SKU-000084
85 Pro Clothing Product 2024 Clothing $480.82 154 2.4 538 SKU-000085
87 Standard Electronics Product Classic Electronics $427.87 158 3.6 112 SKU-000087
88 Super Sports & Outdoors Product Mini Sports & Outdoors $788.87 280 4.9 957 SKU-000088
89 Ultra Clothing Product 2024 Clothing $624.13 322 2.2 487 SKU-000089
90 Professional Books Product Max Books $404.66 27 3.3 380 SKU-000090
91 Super Books Product Advanced Books $760.07 118 2.3 319 SKU-000091
93 Pro Books Product Classic Books $226.12 337 3.0 359 SKU-000093
95 Economy Automotive Product Pro Automotive $585.14 115 1.6 802 SKU-000095
96 Mega Health & Beauty Product Plus Health & Beauty $430.60 252 3.8 307 SKU-000096
97 Pro Home & Garden Product 2024 Home & Garden $236.59 50 1.8 575 SKU-000097
98 Professional Clothing Product Special Edition Clothing $655.24 163 4.9 86 SKU-000098
99 Elite Health & Beauty Product Max Health & Beauty $599.69 317 2.7 125 SKU-000099
100 Super Home & Garden Product Plus Home & Garden $883.39 321 4.8 995 SKU-000100
101 Deluxe Health & Beauty Product Special Edition Health & Beauty $63.90 183 1.1 364 SKU-000101
102 Standard Books Product Mini Books $451.17 476 1.9 503 SKU-000102
104 Deluxe Sports & Outdoors Product Plus Sports & Outdoors $110.96 257 2.2 974 SKU-000104
105 Mega Electronics Product Classic Electronics $917.76 483 3.3 952 SKU-000105
106 Mega Sports & Outdoors Product Advanced Sports & Outdoors $412.27 24 4.0 805 SKU-000106
107 Pro Home & Garden Product Special Edition Home & Garden $395.62 270 2.4 857 SKU-000107
108 Pro Automotive Product Plus Automotive $85.14 148 2.2 711 SKU-000108
109 Professional Clothing Product Pro Clothing $423.88 273 4.2 164 SKU-000109
110 Standard Home & Garden Product Classic Home & Garden $789.99 494 1.0 309 SKU-000110
111 Deluxe Health & Beauty Product Plus Health & Beauty $45.68 204 4.9 458 SKU-000111
112 Super Electronics Product Special Edition Electronics $588.99 226 3.9 334 SKU-000112
113 Economy Sports & Outdoors Product Pro Sports & Outdoors $893.91 358 1.3 253 SKU-000113
114 Pro Office Supplies Product Special Edition Office Supplies $23.00 368 4.7 506 SKU-000114
116 Elite Sports & Outdoors Product Classic Sports & Outdoors $227.59 419 1.8 205 SKU-000116
117 Mega Electronics Product Special Edition Electronics $511.59 169 5.0 653 SKU-000117
118 Deluxe Sports & Outdoors Product Special Edition Sports & Outdoors $339.35 398 1.3 65 SKU-000118
120 Ultra Sports & Outdoors Product Special Edition Sports & Outdoors $78.73 212 2.6 79 SKU-000120
121 Pro Toys & Games Product Special Edition Toys & Games $710.60 140 1.5 746 SKU-000121
123 Pro Office Supplies Product Plus Office Supplies $531.52 184 2.5 442 SKU-000123
124 Elite Home & Garden Product Classic Home & Garden $199.04 143 2.8 339 SKU-000124
125 Elite Food & Grocery Product Advanced Food & Grocery $614.38 19 1.0 51 SKU-000125
126 Mega Toys & Games Product Advanced Toys & Games $631.43 224 1.3 677 SKU-000126
127 Super Toys & Games Product Advanced Toys & Games $220.16 268 2.4 125 SKU-000127
128 Super Books Product 2024 Books $349.65 179 2.0 148 SKU-000128
129 Pro Home & Garden Product Classic Home & Garden $313.20 31 2.2 498 SKU-000129
130 Professional Automotive Product Lite Automotive $140.82 465 1.3 379 SKU-000130
131 Pro Health & Beauty Product Classic Health & Beauty $465.54 71 3.2 474 SKU-000131
132 Super Home & Garden Product XL Home & Garden $90.60 478 1.1 137 SKU-000132
133 Deluxe Clothing Product Mini Clothing $174.34 32 3.4 597 SKU-000133
134 Premium Sports & Outdoors Product Lite Sports & Outdoors $270.22 347 3.5 540 SKU-000134
135 Premium Electronics Product Mini Electronics $728.45 254 4.4 210 SKU-000135
136 Elite Sports & Outdoors Product Pro Sports & Outdoors $561.72 381 3.2 728 SKU-000136
137 Economy Clothing Product Lite Clothing $599.35 134 2.4 781 SKU-000137
138 Standard Books Product Pro Books $933.31 121 4.8 964 SKU-000138
139 Professional Home & Garden Product Pro Home & Garden $756.02 255 1.5 645 SKU-000139
141 Super Home & Garden Product Lite Home & Garden $171.89 219 1.6 151 SKU-000141
142 Economy Health & Beauty Product Advanced Health & Beauty $95.15 399 1.9 41 SKU-000142
143 Pro Office Supplies Product Plus Office Supplies $144.88 28 1.6 346 SKU-000143
144 Ultra Toys & Games Product 2024 Toys & Games $489.32 222 4.7 467 SKU-000144
145 Elite Clothing Product Mini Clothing $339.70 32 2.2 111 SKU-000145
146 Economy Office Supplies Product Special Edition Office Supplies $937.15 117 2.1 465 SKU-000146
147 Mega Electronics Product XL Electronics $409.99 189 2.5 643 SKU-000147
148 Elite Toys & Games Product Special Edition Toys & Games $905.51 430 4.2 675 SKU-000148
149 Economy Office Supplies Product Pro Office Supplies $211.18 226 3.8 292 SKU-000149
150 Economy Health & Beauty Product 2024 Health & Beauty $937.12 282 4.5 997 SKU-000150
151 Premium Electronics Product Lite Electronics $283.39 184 3.3 935 SKU-000151
152 Ultra Electronics Product XL Electronics $673.87 394 3.4 272 SKU-000152
153 Deluxe Sports & Outdoors Product XL Sports & Outdoors $842.02 149 4.1 836 SKU-000153
154 Premium Clothing Product Lite Clothing $178.37 442 4.9 884 SKU-000154
155 Super Health & Beauty Product Max Health & Beauty $241.56 437 3.7 686 SKU-000155
156 Economy Home & Garden Product Mini Home & Garden $178.20 49 3.9 387 SKU-000156
157 Standard Health & Beauty Product 2024 Health & Beauty $763.11 425 4.5 961 SKU-000157
158 Economy Home & Garden Product Classic Home & Garden $476.52 384 1.5 941 SKU-000158
159 Premium Office Supplies Product Plus Office Supplies $829.99 71 2.8 339 SKU-000159
160 Elite Electronics Product Pro Electronics $177.06 254 4.1 585 SKU-000160
161 Pro Office Supplies Product Lite Office Supplies $878.46 279 4.4 780 SKU-000161
162 Deluxe Sports & Outdoors Product Classic Sports & Outdoors $976.17 41 3.3 257 SKU-000162
163 Ultra Health & Beauty Product Advanced Health & Beauty $203.69 115 3.9 921 SKU-000163
164 Professional Automotive Product Lite Automotive $676.90 55 3.6 169 SKU-000164
165 Mega Electronics Product Advanced Electronics $225.52 382 2.1 859 SKU-000165
166 Ultra Books Product Max Books $850.39 202 2.8 3 SKU-000166
167 Professional Electronics Product Classic Electronics $190.98 216 4.7 708 SKU-000167
168 Premium Food & Grocery Product Mini Food & Grocery $223.95 312 4.8 232 SKU-000168
169 Professional Health & Beauty Product 2024 Health & Beauty $644.32 144 1.3 415 SKU-000169
170 Ultra Clothing Product Lite Clothing $190.55 317 1.6 905 SKU-000170
172 Professional Office Supplies Product Plus Office Supplies $739.26 287 4.0 375 SKU-000172
173 Pro Sports & Outdoors Product Pro Sports & Outdoors $349.49 283 3.8 733 SKU-000173
174 Standard Home & Garden Product Classic Home & Garden $817.00 189 3.9 62 SKU-000174
175 Mega Office Supplies Product Plus Office Supplies $169.22 318 3.0 332 SKU-000175
176 Pro Home & Garden Product Classic Home & Garden $820.64 0 4.0 919 SKU-000176
177 Mega Office Supplies Product 2024 Office Supplies $912.16 302 3.6 506 SKU-000177
178 Mega Food & Grocery Product Lite Food & Grocery $41.65 320 1.5 769 SKU-000178
179 Ultra Office Supplies Product Plus Office Supplies $100.55 393 1.3 425 SKU-000179
180 Elite Food & Grocery Product Max Food & Grocery $709.85 392 4.7 668 SKU-000180
181 Standard Sports & Outdoors Product Classic Sports & Outdoors $613.53 260 2.0 83 SKU-000181
182 Premium Health & Beauty Product Plus Health & Beauty $748.16 385 3.7 567 SKU-000182
183 Mega Electronics Product Plus Electronics $137.21 485 3.3 543 SKU-000183
184 Standard Toys & Games Product Max Toys & Games $675.00 82 2.4 658 SKU-000184
185 Super Health & Beauty Product Max Health & Beauty $814.40 410 4.4 579 SKU-000185
186 Professional Office Supplies Product Pro Office Supplies $326.82 25 2.6 841 SKU-000186
187 Ultra Home & Garden Product Lite Home & Garden $101.53 433 1.3 89 SKU-000187
188 Standard Clothing Product Mini Clothing $922.61 483 3.8 534 SKU-000188
189 Economy Electronics Product Advanced Electronics $637.35 112 3.9 514 SKU-000189
190 Ultra Toys & Games Product XL Toys & Games $542.04 462 2.3 359 SKU-000190
191 Premium Health & Beauty Product XL Health & Beauty $426.75 145 2.7 449 SKU-000191
192 Super Electronics Product Plus Electronics $729.25 222 3.1 681 SKU-000192
193 Professional Clothing Product Max Clothing $219.61 297 1.5 351 SKU-000193
194 Economy Electronics Product Classic Electronics $985.98 257 3.2 976 SKU-000194
195 Standard Toys & Games Product Classic Toys & Games $85.92 113 3.2 602 SKU-000195
198 Ultra Sports & Outdoors Product XL Sports & Outdoors $533.37 313 4.4 198 SKU-000198
199 Pro Clothing Product Mini Clothing $612.01 404 2.3 335 SKU-000199
200 Economy Books Product Mini Books $937.23 208 2.4 851 SKU-000200
201 Deluxe Automotive Product Classic Automotive $194.53 115 3.6 374 SKU-000201
202 Premium Health & Beauty Product XL Health & Beauty $906.93 39 3.5 594 SKU-000202
203 Super Automotive Product XL Automotive $123.27 92 4.6 123 SKU-000203
204 Economy Electronics Product XL Electronics $193.57 37 1.2 291 SKU-000204
206 Super Clothing Product Advanced Clothing $131.15 329 4.8 94 SKU-000206
207 Elite Automotive Product Special Edition Automotive $751.26 148 3.9 353 SKU-000207
208 Super Toys & Games Product Plus Toys & Games $504.30 115 4.4 361 SKU-000208
209 Economy Automotive Product XL Automotive $803.34 144 2.4 981 SKU-000209
210 Deluxe Electronics Product Special Edition Electronics $765.60 68 1.4 655 SKU-000210
211 Deluxe Books Product Mini Books $830.74 476 4.8 182 SKU-000211
212 Ultra Automotive Product Mini Automotive $608.05 55 4.4 840 SKU-000212
213 Deluxe Food & Grocery Product XL Food & Grocery $437.55 284 4.3 696 SKU-000213
214 Premium Books Product Mini Books $478.55 297 3.9 965 SKU-000214
215 Standard Toys & Games Product 2024 Toys & Games $519.39 291 2.4 17 SKU-000215
216 Super Books Product Mini Books $520.59 137 4.6 504 SKU-000216
217 Ultra Clothing Product 2024 Clothing $719.18 318 4.8 557 SKU-000217
218 Standard Office Supplies Product Special Edition Office Supplies $23.41 203 3.5 684 SKU-000218
219 Economy Clothing Product Classic Clothing $525.03 482 3.9 905 SKU-000219
220 Super Toys & Games Product Plus Toys & Games $587.39 460 4.7 274 SKU-000220
221 Standard Clothing Product Lite Clothing $236.56 63 4.4 765 SKU-000221
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