How to Create a Composite Index on Multiple Columns in GridDB Using Java API?

2 hours ago 2
ARTICLE AD BOX

I am working on a GridDB time-series container with columns timestamp (TIMESTAMP) and sensor_id (STRING). I want to optimize the performance of a TQL query that filters on both columns:

#code

SELECT * WHERE timestamp > ? AND sensor_id = ?

I attempted to create individual indexes, but the query performance remains suboptimal.

#code

ColumnInfoList columnInfo = new ColumnInfoList(); columnInfo.add(new ColumnInfo("timestamp", GSType.TIMESTAMP)); columnInfo.add(new ColumnInfo("sensor_id", GSType.STRING)); TimeSeriesContainer container = gridStore.putTimeSeries("sensor_data", columnInfo, true); container.createIndex("timestamp_idx", IndexType.TREE, "timestamp"); container.createIndex("sensor_id_idx", IndexType.TREE, "sensor_id");

Specific Questions:

How can I create a composite index on both timestamp and sensor_id using the Java API?

How do I verify that the composite index is being utilized during TQL query execution?

Additional Context: 
The GridDB Java API documentation mentions createIndex but does not clarify if composite indexes are supported or how to define them.

Read Entire Article