Query Terminology – Use of OFFSET and LIMIT

terminology

I am looking for a technical term (or phrase, or something concise) that describes the process of limiting the number of records returned from a query through the use of OFFSET and LIMIT.

For example, I have an application that displays a bunch of records in a table. If I do something naive like this

SELECT * FROM table

It might be slow, especially if there are millions of records, so I optimize my application by using a paginated user interface that will display 50 records at a time. So for example, I want to get records 101 to 150 because the user decided to go to page 3, I might say something like

SELECT * from table LIMIT 50 OFFSET 100

I don't know what kind of words I should be using to describe my design decisions so that others will immediately understand what I'm doing.

Best Answer

It's generally called paging.

Different vendors have implemented it in different ways. SQL Server was late in adopting the standard (OFFSET/FETCH in SQL Server 2012); prior to that you had to use wacky tricks with CTEs and ROW_NUMBER(), and I forget what we did in SQL Server 2000. #temp tables? MySQL chose to one-finger salute the standard and use LIMIT.

Lots of discussion about various techniques for SQL Server in this comment thread.