Thank for your reply!
I sure I have indexed the devId, here is the output of EXPLAIN:
[SELECT
__Z0.DEVID AS __C0_0,
__Z0.ISONLINE AS __C0_1,
__Z0.MQTTTIME AS __C0_2
FROM "device_online_status".T_DEVICE_ONLINE_STATUS __Z0
/* "device_online_status".T_DEVICE_ONLINE_STATUS_DEVID_ASC_IDX: DEVID
IN('1002', '6c072f7d599215dadfs0ya', '6cdff0d13a96d8cec0j8v6',
'6cf3cde4012b74b853qsoe', '6c0d48eb1718840a69yndq', '00200002005043011111',
'vdevp150509677704164', '002yt001sf000000sf0q', '6c2dd83eebd2723329ornu',
'6ce091736ee2cdef6c2gjc', '6c7510b6d2b42b9a46w9j3', '002yt001sf000000sfrz',
'6c05c274a04cca4e00z1tp', '6c6baec455eac8bd17ozfn', '002yt001sf0000gwsfV3')
*/
WHERE __Z0.DEVID IN('1002', '6c072f7d599215dadfs0ya',
'6cdff0d13a96d8cec0j8v6', '6cf3cde4012b74b853qsoe',
'6c0d48eb1718840a69yndq', '00200002005043011111', 'vdevp150509677704164',
'002yt001sf000000sf0q', '6c2dd83eebd2723329ornu', '6ce091736ee2cdef6c2gjc',
'6c7510b6d2b42b9a46w9j3', '002yt001sf000000sfrz', '6c05c274a04cca4e00z1tp',
'6c6baec455eac8bd17ozfn', '002yt001sf0000gwsfV3')]
[SELECT
__C0_0 AS DEVID,
__C0_1 AS ISONLINE,
__C0_2 AS MQTTTIME
FROM PUBLIC.__T0
/* "device_online_status"."merge_scan" */]
And the following code is the way that I create a cache:
List<QueryEntity> entities = getQueryEntities();
cacheCfg.setQueryEntities(entities);
private List<QueryEntity> getQueryEntities() {
List<QueryEntity> entities = Lists.newArrayList();
//配置可见(可被查询)字段
QueryEntity entity = new QueryEntity(String.class.getName(),
DeviceStatusIgniteVO.class.getName());
entity.setTableName(IgniteTableKey.T_DEVICE_ONLINE_STATUS.getCode());
LinkedHashMap<String, String> map = new LinkedHashMap<>();
map.put("devId", "java.lang.String");
map.put("isOnline", "java.lang.Boolean");
map.put("gmtModified", "java.lang.Long");
map.put("mqttTime", "java.lang.Long");
entity.setFields(map);
//配置索引信息
List<QueryIndex> indexes = Lists.newArrayList(new
QueryIndex("devId"));
entity.setIndexes(indexes);
entities.add(entity);
return entities;
}
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/