Limit & Sampling

This page describes how to limit return and sample data in Kafka with Lenses SQL Studio.

Limit the output

To limit the output of the query you can use two approaches:

  • use the LIMIT clause

  • set the max size of the data to be returned

-- limit to 1 record
SELECT *
FROM groceries
LIMIT 1

-- set the data size returned to be 1 megabyte.
SET max.size="1m";

-- on the small dataset we have here 1 MB will accommodate all records added and more
SELECT *
FROM groceries

Set a time limit for a query

To restrict the time to run the query, use SET max.query.time:

SET  max.query.time = '1h';

SELECT ...
    FROM table
    LIMIT 1000

Sampling data

To sample data and discard the first rows:

SELECT *
FROM groceries
LIMIT 1,2

This statement instructs Lenses to skip the first record matched and then sample the next two.

Last updated

Logo

2024 © Lenses.io Ltd. Apache, Apache Kafka, Kafka and associated open source project names are trademarks of the Apache Software Foundation.