Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DELETE statement #5146

Closed
BohuTANG opened this issue May 4, 2022 · 6 comments · Fixed by #5691
Closed

DELETE statement #5146

BohuTANG opened this issue May 4, 2022 · 6 comments · Fixed by #5691
Labels
A-storage Area: databend storage C-feature Category: feature

Comments

@BohuTANG
Copy link
Member

BohuTANG commented May 4, 2022

Summary

Each segment file(parquet) in the underlying storage is immutable; it is not suited for mutable operations (e.g., Delete, Update).
There are many ways to improve that, such as adding a hidden column for each row: 1 mark for deleted, 0 is normal.
The parquet file also needs to read the old and write the new mark flag to the new, the parquet file is compact format(vs. wide format), so it is not well suited for any modification-related operations.
For Databend deletion, the first version must work, then the performance. The initial plan is:

  1. Parse the delete statement
  2. Check which segments are hit by the statement
  3. Create a row-level bitmap in BlockInfo or a single delete file?
  4. Commit the new snapshot
  5. Done

There is already a draft PR in #4228, but it still needs work.

@BohuTANG BohuTANG added C-feature Category: feature A-storage Area: databend storage labels May 4, 2022
@BohuTANG
Copy link
Member Author

BohuTANG commented May 4, 2022

Welcome to comments, @dantengsky

@sundy-li
Copy link
Member

sundy-li commented May 4, 2022

Generally, it's a common way to store an optional extra bitmap inside BlockInfo and apply the filter selection during query.
Deletion is to update this bitmap. Bitmap can be merged during block compaction.

@BohuTANG
Copy link
Member Author

BohuTANG commented May 4, 2022

Generally, it's a common way to store an optional extra bitmap inside BlockInfo and apply the filter selection during query. Deletion is to update this bitmap. Bitmap can be merged during block compaction.

This is a good way(preferred it), if we add an extra bitmap, this bitmap should be binding with one snapshot.
@dantengsky may have more comments on it

@cadl
Copy link
Contributor

cadl commented May 4, 2022

Perhaps we could introduce the “delete_file“ like iceberg.

By the way,why not just borrow iceberg format, but create fuse? The iceberg looks nice.

https://iceberg.apache.org/spec/#delete-formats

@BohuTANG
Copy link
Member Author

BohuTANG commented May 4, 2022

@cadl
Good question, thank you.
The main reason is that there is no Rust Iceberg implementation yet. Fuse engine is a simplified version of Iceberg.

For the delete, as @sundy-li suggested, I think it's the same(idea) as Iceberg did.

@Xuanwo Xuanwo added A-storage Area: databend storage and removed A-storage Area: databend storage labels May 20, 2022
@dantengsky
Copy link
Member

dantengsky commented May 30, 2022

Let's do copy-on-write first. (replace blocks whose rows have been deleted with new blocks). This is the fundamental model we should implement (GDPR)

Merge-on-read is interesting, let's implement it later if a high volume of mutation is required which the copy-on-write can not meet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-storage Area: databend storage C-feature Category: feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants