Cassandra Limit Query - How to Limit Rows Returned in Query Results

Sometimes it is useful to limit the number of rows that are returned from a query. This can be especially useful when querying very large tables.

The Cassandra CQL limit syntax can be used to limit the number of rows returned from a query. Listed below are some examples.

Example 1: Returning the first 10 rows from a table called employee: select * from employee limit 10; Example 2: Returning the first 10000 rows from a table called employee and only selecting a subset of columns: select fname, lname from employee limit 10000;

Many other databases also support limiting rows returned from queries. Listed below are links that show how to limit rows for other popular databases: