【问题标题】:query so slow in influxdb, how to improve the performanceinfluxdb查询这么慢,如何提高性能
【发布时间】: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


    【解决方案1】:

    不确定您对 InfluxDB 的投入程度,但 QuestDB 的性能要很多https://questdb.io/ 支持全 SQL 查询。我一直在对 1.6B 行的 NYC Taxi 数据集进行查询,并在所有 1.6B 行的 sum() 上获得亚秒级结果。

    【讨论】:

      猜你喜欢
      • 2014-07-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-11-23
      • 1970-01-01
      • 1970-01-01
      • 2016-07-19
      • 1970-01-01
      相关资源
      最近更新 更多