简体   繁体   English

influxdb查询这么慢,如何提高性能

[英]query so slow in influxdb, how to improve the performance

I use the influxdb java api to query records from influxdb and found the performance not good have set the query fields to tag below is the sql and execution time in java anybody know how to change or do sth for the query performance thx!我使用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));
}

Not sure how invested you are in InfluxDB, but the performance of QuestDB is a lot better.不确定您在 InfluxDB 上的投入程度,但 QuestDB 的性能好得多。 https://questdb.io/ It supports full SQL for queries. https://questdb.io/它支持完整的 SQL 查询。 I've been running queries against the 1.6B row NYC Taxi dataset and getting sub-second results on a sum() over all 1.6B rows.我一直在对 1.6B 行 NYC Taxi 数据集运行查询,并在所有 1.6B 行的sum()上获得亚秒结果。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM