What we are looking for is - pagination while fetching the data. So if there are 10,000 records matching to the criteria, we want to return only 100 rows on UI and then next 100 etc. In SQL query there is OFFSET/FETCH which we can use.
How to do such thing for SQL on-demand query? Here is our sample query of SQL on demand.