Skip to content

Commit

Permalink
Perform lightweight delete instead of ALTER DELETE
Browse files Browse the repository at this point in the history
  • Loading branch information
hellais committed Sep 6, 2024
1 parent d628112 commit 928874f
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions oonipipeline/src/oonipipeline/temporal/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,14 @@ def maybe_delete_prev_range(db: ClickhouseConnection, prev_range: PrevRange) ->
return ""

wait_for_mutations(db, prev_range.table_name)
# Disabled due to: https://github.com/ClickHouse/ClickHouse/issues/40651
# db.execute("SET allow_experimental_lightweight_delete = true;")

where, q_args = prev_range.format_query()

q_args["max_created_at"] = prev_range.max_created_at
q_args["min_created_at"] = prev_range.min_created_at
where = f"{where} AND created_at <= %(max_created_at)s AND created_at >= %(min_created_at)s"
log.debug(f"runing {where} with {q_args}")

q = f"ALTER TABLE {prev_range.table_name} DELETE "
q = f"DELETE FROM {prev_range.table_name}"
final_query = q + where
db.execute(final_query, q_args)
return final_query
Expand Down

0 comments on commit 928874f

Please sign in to comment.