Efficient Pagination with Skip/Take

Efficient pagination using OFFSET-FETCH on SQL Server.

Execution Time

8 ms

Page Size

100

Current Page

8 / 245

Total Records

24441

Items per page: 25 50 100 200

Page 8 Results Showing 701 - 800 of 24441

ID Name Category Price Stock Rating Reviews SKU
783 Mega Health & Beauty Product Lite Health & Beauty $219.58 485 2.8 226 SKU-000783
784 Ultra Home & Garden Product Classic Home & Garden $855.13 198 1.3 784 SKU-000784
786 Standard Home & Garden Product XL Home & Garden $546.83 379 2.2 682 SKU-000786
787 Professional Office Supplies Product Max Office Supplies $185.32 193 2.0 4 SKU-000787
788 Elite Toys & Games Product Mini Toys & Games $807.85 218 2.5 925 SKU-000788
789 Pro Books Product Classic Books $124.82 287 2.8 990 SKU-000789
790 Professional Books Product Lite Books $755.88 56 2.0 381 SKU-000790
791 Economy Books Product Lite Books $25.30 468 4.3 745 SKU-000791
792 Pro Books Product Advanced Books $354.79 455 4.3 870 SKU-000792
793 Deluxe Home & Garden Product Max Home & Garden $654.85 225 4.8 223 SKU-000793
795 Professional Sports & Outdoors Product Special Edition Sports & Outdoors $858.71 405 1.9 814 SKU-000795
796 Mega Toys & Games Product Max Toys & Games $28.48 455 3.0 615 SKU-000796
797 Deluxe Books Product Classic Books $635.08 22 4.0 810 SKU-000797
798 Professional Health & Beauty Product Plus Health & Beauty $49.30 339 2.2 986 SKU-000798
799 Pro Home & Garden Product Lite Home & Garden $477.84 234 4.0 322 SKU-000799
801 Premium Clothing Product Classic Clothing $121.17 57 4.8 23 SKU-000801
802 Mega Automotive Product Max Automotive $819.72 162 1.3 808 SKU-000802
804 Pro Home & Garden Product Plus Home & Garden $862.50 293 3.3 409 SKU-000804
805 Mega Books Product Classic Books $218.06 271 4.1 244 SKU-000805
806 Super Health & Beauty Product Mini Health & Beauty $626.82 419 3.1 854 SKU-000806
807 Super Automotive Product Pro Automotive $947.77 25 3.7 998 SKU-000807
808 Economy Electronics Product Special Edition Electronics $142.20 472 2.8 811 SKU-000808
809 Elite Toys & Games Product Max Toys & Games $22.81 200 3.2 804 SKU-000809
810 Professional Food & Grocery Product Special Edition Food & Grocery $53.88 190 3.0 73 SKU-000810
811 Ultra Toys & Games Product Advanced Toys & Games $446.85 408 5.0 341 SKU-000811
812 Mega Office Supplies Product Max Office Supplies $469.87 121 2.7 158 SKU-000812
813 Pro Clothing Product Classic Clothing $870.46 164 4.6 13 SKU-000813
815 Professional Automotive Product Mini Automotive $725.69 384 3.9 870 SKU-000815
816 Mega Office Supplies Product Special Edition Office Supplies $571.90 414 2.9 779 SKU-000816
817 Economy Health & Beauty Product 2024 Health & Beauty $319.38 45 2.0 989 SKU-000817
818 Pro Electronics Product Pro Electronics $83.81 189 1.2 780 SKU-000818
819 Professional Automotive Product Pro Automotive $493.98 29 4.2 436 SKU-000819
820 Elite Books Product Mini Books $919.07 483 3.4 148 SKU-000820
822 Mega Automotive Product Max Automotive $88.75 104 3.1 563 SKU-000822
823 Standard Electronics Product 2024 Electronics $44.77 426 3.7 90 SKU-000823
824 Deluxe Electronics Product Advanced Electronics $198.15 125 3.4 703 SKU-000824
825 Pro Books Product Plus Books $726.05 198 3.8 894 SKU-000825
826 Premium Office Supplies Product XL Office Supplies $510.94 54 1.8 690 SKU-000826
827 Pro Electronics Product XL Electronics $552.60 427 2.4 401 SKU-000827
828 Ultra Electronics Product 2024 Electronics $481.04 97 2.5 180 SKU-000828
829 Pro Food & Grocery Product Pro Food & Grocery $833.59 100 3.6 61 SKU-000829
830 Elite Health & Beauty Product Classic Health & Beauty $192.43 233 2.7 595 SKU-000830
831 Elite Home & Garden Product Lite Home & Garden $408.75 18 1.9 286 SKU-000831
832 Mega Health & Beauty Product Max Health & Beauty $618.57 409 3.5 567 SKU-000832
833 Mega Electronics Product 2024 Electronics $855.19 388 4.0 440 SKU-000833
834 Professional Clothing Product Special Edition Clothing $172.10 253 3.4 683 SKU-000834
835 Economy Toys & Games Product Mini Toys & Games $613.68 309 3.8 803 SKU-000835
836 Elite Books Product Pro Books $675.29 487 2.8 787 SKU-000836
837 Elite Toys & Games Product Pro Toys & Games $533.92 130 2.6 227 SKU-000837
838 Premium Clothing Product Pro Clothing $986.81 263 5.0 820 SKU-000838
839 Standard Food & Grocery Product Advanced Food & Grocery $223.92 445 1.7 878 SKU-000839
840 Premium Food & Grocery Product Plus Food & Grocery $449.92 457 2.4 222 SKU-000840
841 Mega Office Supplies Product Advanced Office Supplies $431.00 53 1.1 310 SKU-000841
843 Mega Automotive Product Plus Automotive $764.71 412 3.3 17 SKU-000843
844 Premium Office Supplies Product Max Office Supplies $585.81 281 4.0 660 SKU-000844
845 Premium Automotive Product Advanced Automotive $214.94 233 3.2 282 SKU-000845
846 Ultra Electronics Product XL Electronics $584.53 140 2.0 930 SKU-000846
848 Pro Food & Grocery Product Special Edition Food & Grocery $986.07 234 4.0 353 SKU-000848
849 Mega Office Supplies Product Classic Office Supplies $590.15 499 2.0 465 SKU-000849
850 Standard Food & Grocery Product Plus Food & Grocery $714.12 226 2.1 655 SKU-000850
851 Premium Sports & Outdoors Product Advanced Sports & Outdoors $825.79 135 1.1 151 SKU-000851
852 Deluxe Toys & Games Product Pro Toys & Games $448.83 74 1.6 895 SKU-000852
853 Mega Food & Grocery Product Mini Food & Grocery $212.90 225 2.6 39 SKU-000853
854 Pro Electronics Product Pro Electronics $885.10 193 1.4 683 SKU-000854
855 Premium Electronics Product Advanced Electronics $873.54 80 1.3 461 SKU-000855
856 Deluxe Toys & Games Product 2024 Toys & Games $103.23 61 4.2 159 SKU-000856
857 Mega Toys & Games Product 2024 Toys & Games $75.73 398 3.7 0 SKU-000857
858 Pro Health & Beauty Product 2024 Health & Beauty $810.19 313 2.1 540 SKU-000858
859 Economy Electronics Product Pro Electronics $683.35 236 1.5 887 SKU-000859
860 Super Toys & Games Product Max Toys & Games $285.37 468 1.7 274 SKU-000860
861 Pro Office Supplies Product Lite Office Supplies $915.80 201 3.5 968 SKU-000861
862 Super Books Product XL Books $261.38 78 1.9 257 SKU-000862
864 Professional Books Product Plus Books $942.17 133 2.0 907 SKU-000864
865 Elite Food & Grocery Product 2024 Food & Grocery $485.21 264 2.6 170 SKU-000865
866 Pro Clothing Product 2024 Clothing $838.96 38 1.1 574 SKU-000866
867 Professional Clothing Product Advanced Clothing $14.88 395 3.1 215 SKU-000867
868 Standard Clothing Product Max Clothing $325.03 98 4.4 391 SKU-000868
869 Premium Sports & Outdoors Product Mini Sports & Outdoors $11.66 382 2.6 573 SKU-000869
870 Elite Books Product Mini Books $314.88 437 1.1 122 SKU-000870
871 Economy Clothing Product Special Edition Clothing $321.96 358 1.8 863 SKU-000871
872 Deluxe Home & Garden Product Classic Home & Garden $650.05 309 3.4 31 SKU-000872
874 Standard Office Supplies Product Plus Office Supplies $798.82 275 1.7 412 SKU-000874
875 Deluxe Food & Grocery Product XL Food & Grocery $115.11 142 2.4 341 SKU-000875
876 Economy Sports & Outdoors Product Classic Sports & Outdoors $920.67 484 4.7 526 SKU-000876
877 Professional Automotive Product Plus Automotive $326.52 9 2.1 22 SKU-000877
878 Elite Toys & Games Product XL Toys & Games $940.28 21 3.8 284 SKU-000878
879 Elite Clothing Product Plus Clothing $452.39 216 1.3 75 SKU-000879
880 Standard Home & Garden Product XL Home & Garden $665.48 414 4.8 71 SKU-000880
881 Professional Electronics Product Lite Electronics $487.59 308 5.0 730 SKU-000881
882 Economy Home & Garden Product Plus Home & Garden $562.90 140 2.3 200 SKU-000882
883 Deluxe Electronics Product 2024 Electronics $842.38 149 2.9 164 SKU-000883
884 Economy Electronics Product XL Electronics $761.68 484 2.6 35 SKU-000884
886 Deluxe Toys & Games Product Max Toys & Games $856.26 167 1.4 314 SKU-000886
887 Economy Sports & Outdoors Product XL Sports & Outdoors $831.35 125 3.1 59 SKU-000887
888 Super Toys & Games Product Classic Toys & Games $385.08 348 3.6 908 SKU-000888
889 Mega Home & Garden Product Special Edition Home & Garden $387.25 367 1.4 616 SKU-000889
890 Super Sports & Outdoors Product Advanced Sports & Outdoors $785.38 275 1.7 866 SKU-000890
891 Economy Food & Grocery Product Advanced Food & Grocery $855.25 127 3.4 734 SKU-000891
892 Standard Food & Grocery Product Classic Food & Grocery $284.89 277 4.0 557 SKU-000892
893 Elite Food & Grocery Product Max Food & Grocery $843.26 379 2.0 920 SKU-000893
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