By default, Simple Log Service returns 100 rows of data in the query and analysis results. You can use a LIMIT clause to specify the number of rows that can be returned.
Syntax
Simple Log Service supports the following types of LIMIT clauses:
The following LIMIT clause returns the first x rows of data in the query and analysis results:
LIMIT x
The following LIMIT clause returns x rows of data starting from the y row in the query and analysis results:
LIMIT y, x
The LIMIT clause is used to obtain final results rather than SQL intermediate results.
You cannot use LIMIT clauses in subqueries. For example, the following statement is invalid:
* | select count(1) from ( select distinct(url) from limit 0,1000)
.
Parameters
Parameter | Description |
x | The number of rows that can be returned.
|
y | The offset. Valid values: [0,1000000]. |
The sum of x and y cannot exceed 1,000,000.
Examples
Return the first 200 rows of data in the query and analysis results.
Query statement
* | SELECT request_time LIMIT 200
Query and analysis results
Return 1,000 rows of data with an offset of 100 in the query and analysis results.
Query statement
* | SELECT request_time LIMIT 100,1000
Query and analysis results
Return the top three request URIs with the longest request durations.
Query statement
* | SELECT request_uri AS top_3, request_time ORDER BY request_time DESC LIMIT 3
Query and analysis results