I'm using GridDB CE v5.0 with the Java client for a time-series IoT data application. Each TimeSeries container logs data like this:
class Telemetry {
Timestamp timestamp;
String deviceId;
float temperature;
boolean isCalibrated;
}
My use case requires high-speed queries on non-key columns — specifically filtering by:
deviceId (not the container name)
isCalibrated = true
This must happen without full table scan, ideally using an index.
What I’ve done so far:
I’ve created a TimeSeries container.
Inserted ~10M rows from 1000 devices.
I attempted to filter like this:
Query query = ts.query(
"SELECT * WHERE deviceId = 'sensor-42' AND isCalibrated = true AND timestamp > TIMESTAMPADD(DAY, -1, NOW())"
);
RowSet<Row> rs = query.fetch();
But profiling shows full scan occurs, which leads to poor performance. I expected GridDB to optimize this using some internal index — but that doesn’t seem to happen.
Question
How can I create and utilize secondary indexes (on deviceId, isCalibrated, etc.) for efficient filtering in TimeSeries containers using Java API?