GridDB Java: is there any way to limit query results (like LIMIT in SQL)?

4 hours ago 2
ARTICLE AD BOX

I’m using GridDB with the Java API and ran into a small issue while working with queries.

I have a container with a lot of data, and I only need to read a small portion of it (for example, the first 100 rows). My query looks like this:

Query<SensorData> query = container.query( "SELECT * FROM sensor_data WHERE deviceId = 'device_1'" ); RowSet<SensorData> rs = query.fetch();

This returns all matching rows, which can be quite large. In a typical SQL database, I would just use something like LIMIT 100, but I couldn’t find a clear equivalent in GridDB’s query syntax.

I tried checking the documentation but didn’t see anything obvious for limiting result size directly in the query.

Read Entire Article