Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.