- Documentation
Torch Log Service
User Guide
Query and analysis
SQL syntax
LIMIT syntax
LIMIT syntax
The LIMIT syntax is used to limit the number of result rows returned by a SELECT statement. By default, only 100 rows of data are returned when performing query and analysis on logs. You can adjust the number of returned rows using the LIMIT syntax, with a supported range of 1 to 1,000,000. This article introduces the LIMIT syntax format and examples.
Syntax format
LIMIT syntax is as follows.
- Return the first n rows of data from the calculation results.
- Return n rows of data from the calculation results, starting from row s+1; only data from row s+1 onward is read, and the total number of rows read is n.
The parameters are described below:
Notice
When using nested subqueries, the LIMIT syntax is not supported within clauses. For a detailed explanation of nested subqueries, see Nested subquery. Syntax example
- Count the number of requests for each status code and return the counts for the top three status codes with the highest request numbers.
- Query analysis statement
- Query and analysis results
-
- Count the number of requests for each user, and return the data from row 5 to row 9, for a total of 5 rows.
- Query and analysis statement
- Query and analysis results
-
Last updated: 2025.12.12 18:45:50