【问题标题】:Very slow ingestion to QuestDB when using Postgres wire protocol使用 Postgres 有线协议时对 QuestDB 的摄取非常缓慢
【发布时间】:2021-09-09 13:07:08
【问题描述】:

在将行插入 QuestDB 表时,我遇到了摄取时间问题。 表定义:

create table trade1 (
    id symbol,
    buy_order_id string,
    currency string,
    price float,
    quantity float,
    instrument_id symbol,
    sell_order_id string,
    status string,
    subtype symbol,
    "type" string,
    transact_time timestamp,
    buy_trader_id string,
    sell_trader_id string);
) timestamp(transact_time)  PARTITION BY DAY;

我有一个 ETL 过程,它从 CSV 文件中提取数据并使用 JDBC Postgrs 驱动程序插入数据。

当我从第一个文件的空表中插入数据时 - 大约 300k 行需要大约 60 秒。 然而,对于第二个文件,它需要更长的时间 - 180 秒。 Forth 文件超过 10 分钟。

所有文件的行数都相似。

此外,当我只保留一个 symbol 列时,它似乎更快,但随着插入更多行,速度会降低:

create table trade1 (
    id string,
    buy_order_id string,
    currency string,
    price float,
    quantity float,
    instrument_id symbol,
    sell_order_id string,
    status string,
    subtype string,
    "type" string,
    transact_time timestamp,
    buy_trader_id string,
    sell_trader_id string);
) timestamp(transact_time)  PARTITION BY DAY;

插入时间:15s, 19s, 29s, 37s, 35s, 59s, 62s, 74s 所以它在不断增长。

似乎摄取时间与插入的行数一起增长,但是当甚至没有定义索引时怎么可能呢?

server.conf:

data:
  server.conf: |
    cairo.sql.append.page.size = 256

    pg.worker.affinity = 1,2,3,4

    pg.worker.count = 4

    shared.worker.count = 2

QuestDB 使用 Helm 图表部署在 Kubernetes 上。

我是否遗漏了一些核心概念?

【问题讨论】:

    标签: questdb


    【解决方案1】:

    如果将 instrument_id 从 SYMBOL 更改为 STRING,它是否仍然显示缓慢?

    如果您可以“按原样”提取源 CSV,则 REST 导入速度非常快。

    在我的基准测试中,与 REST /imp 和 InfluxDB 线路协议相比,使用 PostgreSQL 有线协议是最慢的(耗时 2-3 倍)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-02-27
      • 2012-06-13
      • 1970-01-01
      • 1970-01-01
      • 2016-12-12
      • 1970-01-01
      • 2017-01-07
      • 2010-10-24
      相关资源
      最近更新 更多