-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Add settings 'limit' and 'offset'. #16176
Description
These settings will act as the separate limit and offset applied to query result
(as if query is put into subquery and additional LIMIT and/or OFFSET is added outside).
They should be implemented by adjusting existing LIMIT and/or OFFSET if any or by adding LIMIT and/or OFFSET if there were not in InterpreterSelectQuery.
Example:
Suppose we have a query:
SELECT * FROM table LIMIT 100 OFFSET 1000
And the setting limit is set to 50 and offset is set to 75.
Then we should execute this query as the following:
SELECT * FROM table LIMIT 25 OFFSET 1075
Use case:
API that allows the user to provide arbitrary queries but wants to apply pagination of the result.
If user did not supply the limit in their query, the settings will allow to paginate the whole result.
If user supplied limit in their query, the settings will allow to paginate within already limited result.