Skip to content

[Bug]: insert into select is very slow. #14692

Closed

Description

@Ariznawlll

Is there an existing issue for the same bug?

  • I have checked the existing issues.

Branch Name

main

Commit ID

ead69b4

Other Environment Information

- Hardware parameters:
- OS type:
- Others:

Actual Behavior

10亿数据量 insert into select花了大约80分钟才成功:
image

job url(Load and insert test -> insert into select):
https://github.com/matrixorigin/mo-nightly-regression/actions/runs/8029862130/job/21936797207

log: http://175.178.192.213:30088/explore?panes=%7B%22ZYH%22:%7B%22datasource%22:%22loki%22,%22queries%22:%5B%7B%22refId%22:%22A%22,%22expr%22:%22%7Bnamespace%3D%5C%22branch-big-data-nightly-ead69b4%5C%22%7D%20%7C%3D%20%60%60%22,%22queryType%22:%22range%22,%22datasource%22:%7B%22type%22:%22loki%22,%22uid%22:%22loki%22%7D,%22editorMode%22:%22builder%22%7D%5D,%22range%22:%7B%22from%22:%221708793400000%22,%22to%22:%221708800600000%22%7D%7D%7D&schemaVersion=1&orgId=1

Expected Behavior

No response

Steps to Reproduce

create table  if not exists big_data_test.table_basic_for_load_1B(
col1 tinyint,
col2 smallint,
col3 int,
col4 bigint,
col5 tinyint unsigned,
col6 smallint unsigned,
col7 int unsigned,
col8 bigint unsigned,
col9 float,
col10 double,
col11 varchar(255),
col12 Date,
col13 DateTime,
col14 timestamp,
col15 bool,
col16 decimal(16,6),
col17 text,
col18 json,
col19 blob,
col20 binary(255),
col21 varbinary(255),
col22 vecf32(3),
col23 vecf32(3),
col24 vecf64(3),
col25 vecf64(3)
);

load data url s3option {'endpoint'='http://cos.ap-guangzhou.myqcloud.com','access_key_id'='***','secret_access_key'='***','bucket'='mo-load-guangzhou-1308875761', 'filepath'='mo-big-data/1000000000_20_columns_load_data_pk.csv'} into table big_data_test.table_with_pk_for_load_1B fields terminated by '|' lines terminated by '\n' ignore 1 lines parallel 'true';

create table  if not exists big_data_test.table_with_pk_for_insert_1B(
id bigint primary key,
col1 tinyint,
col2 smallint,
col3 int,
col4 bigint,
col5 tinyint unsigned,
col6 smallint unsigned,
col7 int unsigned,
col8 bigint unsigned,
col9 float,
col10 double,
col11 varchar(255),
col12 Date,
col13 DateTime,
col14 timestamp,
col15 bool,
col16 decimal(16,6),
col17 text,
col18 json,
col19 blob,
col20 binary(255),
col21 varbinary(255),
col22 vecf32(3),
col23 vecf32(3),
col24 vecf64(3),
col25 vecf64(3)
);


insert into big_data_test.table_with_pk_for_insert_1B(id,col1,col2,col3,col4,col5,col6,col7,col8,col9,col10,col11,col12,col13,col14,col15,col16,col17,col18,col19,col20,col21,col22,col23,col24,col25)  select * from big_data_test.table_with_pk_for_load_1B;

Additional information

No response

Activity

  1. added
    kind/bug
    severity/s0
    on Feb 26, 2024
  2. added this to the 1.2.0 milestone on Feb 26, 2024
  3. jensenojs commented on Mar 27, 2024

    @jensenojs
    Contributor

    load的SQL因为权限的问题本地还是没跑成功, 在本地的ubuntu上使用下面的SQL进行模拟, 并没有复现成功, 一亿规模的insert into select 耗时也是一分钟多一些. 算符合预期. 现在big_data_test是一周跑一次, 可以等后续看看有没有复现, 如果还有复现的话, 可能需要进一步测试一下特定数据类型比如说vecf的插入性能.

    create table  if not exists t0(
    col1 bigint,
    col2 bigint,
    col3 bigint,
    col4 bigint,
    col5 bigint,
    col6 bigint,
    col7 bigint,
    col8 bigint,
    col9 bigint,
    col10 bigint,
    col11 bigint,
    col12 bigint,
    col13 bigint,
    col14 bigint,
    col15 bigint,
    col16 bigint,
    col17 bigint,
    col18 bigint,
    col19 bigint,
    col20 bigint,
    col21 bigint,
    col22 varchar(26),
    col23 varchar(26),
    col24 varchar(26),
    col25 varchar(26)
    );
    
    insert into t0 select result, result, result, result, result, result, result, result, result, result, result, result,
     result, result, result, result, result, result, result, result, result, result || "22", result || "23", result || "24", result || "25" 
     from generate_series(1,100000000) g;
    ...
    image
  4. jensenojs commented on Apr 1, 2024

    @jensenojs
    Contributor

    测个十亿规模的看看耗时

    without pk : 15 min 38.60s
    image

    with pk : 22.10.85
    image

  5. jensenojs commented on Apr 8, 2024

    @jensenojs
    Contributor

    休假中

  6. jensenojs commented on Apr 12, 2024

    @jensenojs
    Contributor

    无进展

  7. jensenojs commented on Apr 17, 2024

    @jensenojs
    Contributor

    not working on it

  8. jensenojs commented on Apr 22, 2024

    @jensenojs
    Contributor

    处理其他s-1

  9. removed this from the 1.2.0 milestone on Apr 24, 2024
  10. 9 remaining items

  11. jensenojs commented on Jun 26, 2024

    @jensenojs
    Contributor

    最新的结果看似乎快了三十分钟

    image
  12. jensenojs commented on Jul 1, 2024

    @jensenojs
    Contributor

    等1.2-dev上的pr在合并之后看一下

  13. jensenojs commented on Jul 4, 2024

    @jensenojs
    Contributor

    处理中移物联的insert pprof

  14. jensenojs commented on Jul 9, 2024

    @jensenojs
    Contributor

    not working on it

  15. modified the milestones: 1.3.0-Backlog, 1.3.0 on Jul 15, 2024
  16. Ariznawlll commented on Jul 17, 2024

    @Ariznawlll
    CollaboratorAuthor

    1.2-dev
    commit-id: 74f04eb

    image

    main
    commit-id: c1751aa
    image

    main与1.2-dev性能已经同步,性能从大约80min提升到45min左右。

  17. allengaoo commented on Jul 17, 2024

    @allengaoo

    这个问题主要用于解决CTAS 性能慢的问题,针对这方面的问题,看起来已经优化到原有时间的一半左右。

    另外,针对1.3.0 版本 OLTP 负载的性能指标也有和insert 相关的内容, 建议把这个场景放到1.3.0 版本的测试计划中,之后关闭这个issue, 并在1.3.0 版本中对该场景进行测试,需要达到的目标为:

    1. 1.3.0 版本的性能相较于1.2.2 版本不回退。
    2. 1.3.0 版本的性能,知道达到 mysql性能的20%
  18. jensenojs commented on Jul 17, 2024

    @jensenojs
    Contributor

    这个问题主要用于解决CTAS 性能慢的问题,针对这方面的问题,看起来已经优化到原有时间的一半左右。

    另外,针对1.3.0 版本 OLTP 负载的性能指标也有和insert 相关的内容, 建议把这个场景放到1.3.0 版本的测试计划中,之后关闭这个issue, 并在1.3.0 版本中对该场景进行测试,需要达到的目标为:

    1. 1.3.0 版本的性能相较于1.2.2 版本不回退。
    2. 1.3.0 版本的性能,知道达到 mysql性能的20%

    @allengaoo 斌哥, 这里的第二个目标可能需要再看一下, 现在mo在大数据量下的insert into select不见得比mysql慢的.

  19. allengaoo commented on Jul 17, 2024

    @allengaoo

    ok. 如果说MO 在这种场景下的性能会比mysql 高的话, 那这个地方建议对于测试的标准改为以下的内容:
    1.3.0 版本的性能相较于1.2.2 版本不回退。
    1.3.0 版本的性能,至少达到 mysql性能的120% ,MySQL 的 CTAS时间 / mo 的CTAS时间 >= 1.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bugphase/testingseverity/s0

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions