Limit & Sampling
Understand using limits and sampling when querying Kafka topic data with Lenses SQL Snapshot concepts engine for Apache Kafka
Limit the output
Use LIMIT to limit output records. Use max.size to limit the amount of Kafka data scanned:
LIMITlimits returned records.max.sizelimits Kafka data scanned, expressed as bytes.
-- Return at most one record.
SELECT *
FROM groceries
LIMIT 1;
-- Scan at most 1 MB of Kafka data.
SET max.size = '1m';
-- This cap can stop the query before LIMIT finds enough matching records.
SELECT *
FROM groceries;max.size is not a memory allocation. It does not set the number of returned records.
Set a time limit for a query
To restrict the time to run the query, use SET max.query.time:
Sampling data
To sample data and discard the first rows:
This statement instructs Lenses to skip the first record matched and then sample the next two.
Last updated
Was this helpful?

