In the real world, we load the data on the front from the database one time and load it into memory via data table or in some other form (main table and other supported tables) and
then loop through individual records in Parallel For Each for better performance. However, in some cases, if the data load is huge,
we may end up having memory issues loading all the records on the front so weload each individual record inside the loop in SQL which could potentially affect the performance.
Example :
SELECT First_Name + ' ' + Last_Name FROM REgistration
ORDER BY First_Name OFFSET 10 ROWS FETCH NEXT 5 ROWS ONLY;
In this example, it will skip the first 10 rows and return the next 5 rows.
Limitations while Using OFFSET-FETCH
then loop through individual records in Parallel For Each for better performance. However, in some cases, if the data load is huge,
we may end up having memory issues loading all the records on the front so weload each individual record inside the loop in SQL which could potentially affect the performance.
Example :
SELECT First_Name + ' ' + Last_Name FROM REgistration
ORDER BY First_Name OFFSET 10 ROWS FETCH NEXT 5 ROWS ONLY;
In this example, it will skip the first 10 rows and return the next 5 rows.
Limitations while Using OFFSET-FETCH
- ORDER BY is mandatory to use OFFSET and FETCH clause.
- OFFSET clause is mandatory with FETCH. You can never use, ORDER BY … FETCH.
- TOP cannot be combined with OFFSET and FETCH in the same query expression.
- The OFFSET/FETCH row count expression can be any arithmetic, constant, or parameter expression that will return an integer value. The row count expression does not support scalar sub-queries.
Comments
Post a Comment