【发布时间】:2020-03-07 08:16:20
【问题描述】:
我使用 influxdb java api 从 influxdb 查询记录 发现性能不好 已将查询字段设置为标记 下面是java中的sql和执行时间 任何人都知道如何更改或为查询性能做某事 谢谢!
> select count(*) from propRecords where devId='1000000005020009' and propKey='B_phs_V' and time >=1583424000000000000 and time <=1584028800000000000
name: propRecords
time count_cmd count_propValue
---- --------- ---------------
1583424000000000000 269632 269632
> select time,cmd,propKey,propValue from propRecords where devId='1000000005020009' and propKey='B_phs_V' and time >=1583424000000000000 and time <=1584028800000000000";
execution time in java code:2813ms
execution time in java code:2915ms
execution time in java code:2721ms
execution time in java code:2457ms
execution time in java code:2506ms
execution time in java code:2515ms
execution time in java code:2746ms
execution time in java code:2837ms
execution time in java code:2417ms
execution time in java code:2793ms
> select count(*) from propRecords where time >=1583424000000000000 and time <=1584028800000000000;
name: propRecords
time count_cmd count_propValue
---- --------- ---------------
1583424000000000000 1078393 1078393
> select time,cmd,propKey,propValue from propRecords where time >=1583424000000000000 and time <=1584028800000000000;
execution time in java code:12539ms
execution time in java code:11449ms
execution time in java code:14092ms
execution time in java code:11174ms
execution time in java code:12074ms
execution time in java code:11254ms
execution time in java code:11331ms
execution time in java code:12529ms
use below influx api to query:
InfluxDB.class
public QueryResult query(Query query) {
return this.executeQuery(this.callQuery(query));
}
【问题讨论】:
标签: java database influxdb opentsdb