Skip to content

Merge delete conditions to reduce judgments #4915

@acelyc111

Description

@acelyc111

Is your feature request related to a problem? Please describe.
Suppose there are several DELETE operations on a table, and the table has only 1 tablet:

DELETE FROM tbl WHERE date < '2020-11-01';
DELETE FROM tbl WHERE date < '2020-11-02';
DELETE FROM tbl WHERE date < '2020-11-03';
DELETE FROM tbl WHERE date < '2020-11-04';

There will be 4 delete predicates on a tablet, then launch a query on the table, doris will judge at most 4 predicates for every block or row, which is inefficient.

Describe the solution you'd like
We can merge the 4 predicates to one, for the example above, it should be:

DELETE FROM tbl WHERE date < '2020-11-04';

We can implement it in class DeleteHandler.
At the first step, the merge operation can be performed when delete predicate has conditions on only 1 column, we can merge similar predicates on the same column, the result is the union set for sub predicates.

op1      op2      result
eq       eq       in
eq       in       in
ne       ne       not in
ne       not in   not in
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions