Open topic with navigation

TIBCO ActiveSpaces® - Enterprise Edition 5.0.0

# LIMIT Clause

The LIMIT clause is used to specify the maximum number of rows to return for a query.

The following code shows the syntax of the LIMIT clause supported by ActiveSpaces:

    LIMIT <rowcount expression>

The LIMIT clause affects the number of result rows for the query. The LIMIT clause, if specified, must be the last clause of the SELECT statement and is the last clause applied to a query. In other words, the LIMIT clause is applied after the WHERE clause is applied, the GROUP BY clause is applied, and the ORDER BY clause is applied. The LIMIT clause does not affect the number of rows scanned for a query.

## LIMIT Clause and Full Table Scan Property

When the WHERE clause of a SELECT statement does not refer to the primary key or secondary indexes of a table, the entire table must be scanned to find the rows of the table that is returned for a query. This process of scanning the entire table is known as `full table scan`. When a LIMIT clause is appended to a SELECT statement, it does not affect whether a full table scan is performed. However, the LIMIT clause affects the number of results returned for the query, but not how many rows are scanned for a table. The rows resulting from the scan might then also have to be grouped with a GROUP BY clause and then sorted with ORDER BY clauses. The final set of result rows are then limited by the count specified for the LIMIT clause.

Did you find this helpful?

Yes No
Great!
Thanks for taking the time to give us some feedback.
Sorry about that

Why wasn't this helpful? (check all that apply)

Could not find what I was looking for
Instructions confusing or unclear
Instructions did not work

Want to tell us more?

Please select at least one option or provide details about the issue!!

Error occurred while submitting feedback.

Error2 occurred while submitting feedback.

TIBCO ActiveSpaces® - Enterprise Edition

Copyright © 2009-2025. Cloud Software Group, Inc. All Rights Reserved.