Skip to content

Conversation

@bobhan1
Copy link
Contributor

@bobhan1 bobhan1 commented Jul 26, 2023

Proposed changes

Currently, when executing insert into select statement converted from a delete statement, doris will try to read all the values of the non-key columns from the previous rows with the same key in storage layer, which is highly costly and meaningless.
For example, for a table with the following schema

CREATE TABLE test (
    `k1` int NOT NULL,
    `c1` int,
    `c2` int,
    `c3` int,
    `c4` int)
UNIQUE KEY(`k1`) DISTRIBUTED BY HASH(`k1`) BUCKETS 1
PROPERTIES("enable_unique_key_merge_on_write" = "true")

and data

k1,c1,c2,c3,c4
1,1,1,1,1
2,2,2,2,2
3,3,3,3,3
4,4,4,4,4
5,5,5,5,5

after execute some delete statement(which is transformed to insert into select statement) that delete rows with k1=1,2,3, the data with delete_sign column will be like

k1,c1,c2,c3,c4,__DORIS_DELETE_SIGN__
1,1,1,1,1,0
2,2,2,2,2,0
3,3,3,3,3,0
4,4,4,4,4,0
5,5,5,5,5,0
1,1,1,1,1,1
2,2,2,2,2,1
3,3,3,3,3,1

It's evitable that it reads lots of useless data. So this PR eliminates the above process and use default or null value to fill the non-key columns when inserting rows with marked delete sign, since the values in these columns are useless and will not be read.

Further comments

If this is a relatively large or complex change, kick off the discussion at dev@doris.apache.org by explaining why you chose the solution you did and what alternatives you considered, etc...

@bobhan1
Copy link
Contributor Author

bobhan1 commented Jul 26, 2023

run buildall

@github-actions
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@hello-stephen
Copy link
Contributor

(From new machine)TeamCity pipeline, clickbench performance test result:
the sum of best hot time: 45.36 seconds
stream load tsv: 506 seconds loaded 74807831229 Bytes, about 140 MB/s
stream load json: 20 seconds loaded 2358488459 Bytes, about 112 MB/s
stream load orc: 65 seconds loaded 1101869774 Bytes, about 16 MB/s
stream load parquet: 31 seconds loaded 861443392 Bytes, about 26 MB/s
insert into select: 29.6 seconds inserted 10000000 Rows, about 337K ops/s
storage size: 17166804879 Bytes

@bobhan1
Copy link
Contributor Author

bobhan1 commented Jul 26, 2023

run buildall

@github-actions
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@hello-stephen
Copy link
Contributor

(From new machine)TeamCity pipeline, clickbench performance test result:
the sum of best hot time: 45.4 seconds
stream load tsv: 505 seconds loaded 74807831229 Bytes, about 141 MB/s
stream load json: 20 seconds loaded 2358488459 Bytes, about 112 MB/s
stream load orc: 64 seconds loaded 1101869774 Bytes, about 16 MB/s
stream load parquet: 30 seconds loaded 861443392 Bytes, about 27 MB/s
insert into select: 29.0 seconds inserted 10000000 Rows, about 344K ops/s
storage size: 17169927022 Bytes

@bobhan1
Copy link
Contributor Author

bobhan1 commented Jul 26, 2023

run p0

1 similar comment
@bobhan1
Copy link
Contributor Author

bobhan1 commented Jul 26, 2023

run p0

@bobhan1
Copy link
Contributor Author

bobhan1 commented Jul 27, 2023

run buildall

@github-actions
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@bobhan1
Copy link
Contributor Author

bobhan1 commented Jul 27, 2023

run arm

@hello-stephen
Copy link
Contributor

(From new machine)TeamCity pipeline, clickbench performance test result:
the sum of best hot time: 45.19 seconds
stream load tsv: 509 seconds loaded 74807831229 Bytes, about 140 MB/s
stream load json: 20 seconds loaded 2358488459 Bytes, about 112 MB/s
stream load orc: 64 seconds loaded 1101869774 Bytes, about 16 MB/s
stream load parquet: 31 seconds loaded 861443392 Bytes, about 26 MB/s
insert into select: 29.4 seconds inserted 10000000 Rows, about 340K ops/s
storage size: 17168762914 Bytes

@zhannngchen zhannngchen added dev/2.0.0 2.0.0 release and removed dev/2.0.1 labels Jul 27, 2023
@bobhan1
Copy link
Contributor Author

bobhan1 commented Jul 27, 2023

run buildall

@github-actions
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@hello-stephen
Copy link
Contributor

(From new machine)TeamCity pipeline, clickbench performance test result:
the sum of best hot time: 45.02 seconds
stream load tsv: 507 seconds loaded 74807831229 Bytes, about 140 MB/s
stream load json: 20 seconds loaded 2358488459 Bytes, about 112 MB/s
stream load orc: 65 seconds loaded 1101869774 Bytes, about 16 MB/s
stream load parquet: 31 seconds loaded 861443392 Bytes, about 26 MB/s
insert into select: 29.2 seconds inserted 10000000 Rows, about 342K ops/s
storage size: 17161308750 Bytes

@bobhan1
Copy link
Contributor Author

bobhan1 commented Jul 27, 2023

run buildall

@github-actions
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@hello-stephen
Copy link
Contributor

(From new machine)TeamCity pipeline, clickbench performance test result:
the sum of best hot time: 45.58 seconds
stream load tsv: 508 seconds loaded 74807831229 Bytes, about 140 MB/s
stream load json: 20 seconds loaded 2358488459 Bytes, about 112 MB/s
stream load orc: 64 seconds loaded 1101869774 Bytes, about 16 MB/s
stream load parquet: 32 seconds loaded 861443392 Bytes, about 25 MB/s
insert into select: 29.6 seconds inserted 10000000 Rows, about 337K ops/s
storage size: 17161006017 Bytes

@bobhan1 bobhan1 requested a review from zhannngchen July 28, 2023 00:46
@bobhan1
Copy link
Contributor Author

bobhan1 commented Jul 28, 2023

run buildall

@github-actions
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

Copy link
Contributor

@zhannngchen zhannngchen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Jul 28, 2023
@github-actions
Copy link
Contributor

PR approved by at least one committer and no changes requested.

@github-actions
Copy link
Contributor

PR approved by anyone and no changes requested.

@bobhan1
Copy link
Contributor Author

bobhan1 commented Jul 28, 2023

run clickbench

@hello-stephen
Copy link
Contributor

(From new machine)TeamCity pipeline, clickbench performance test result:
the sum of best hot time: 44.82 seconds
stream load tsv: 506 seconds loaded 74807831229 Bytes, about 140 MB/s
stream load json: 20 seconds loaded 2358488459 Bytes, about 112 MB/s
stream load orc: 65 seconds loaded 1101869774 Bytes, about 16 MB/s
stream load parquet: 31 seconds loaded 861443392 Bytes, about 26 MB/s
insert into select: 29.2 seconds inserted 10000000 Rows, about 342K ops/s
storage size: 17169997476 Bytes

Copy link
Contributor

@liaoxin01 liaoxin01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zhannngchen zhannngchen merged commit 0c734a8 into apache:master Jul 28, 2023
@xiaokang xiaokang added dev/2.0.0-merged and removed dev/2.0.0 2.0.0 release labels Jul 28, 2023
xiaokang pushed a commit that referenced this pull request Jul 28, 2023
zhannngchen pushed a commit that referenced this pull request Aug 7, 2024
…umns for delete stmt in publish phase (#38703)

#22270 should also do in pulish phase
dataroaring pushed a commit that referenced this pull request Aug 11, 2024
…umns for delete stmt in publish phase (#38703)

#22270 should also do in pulish phase
wyxxxcat pushed a commit to wyxxxcat/doris that referenced this pull request Aug 14, 2024
…umns for delete stmt in publish phase (apache#38703)

apache#22270 should also do in pulish phase
dataroaring pushed a commit that referenced this pull request Aug 16, 2024
…umns for delete stmt in publish phase (#38703)

#22270 should also do in pulish phase
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by one committer. dev/2.0.0-merged reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants