Skip to content

Commit e83e897

Browse files
committed
handle edge case with large variant inserts
1 parent 464c034 commit e83e897

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

v03_pipeline/lib/misc/clickhouse.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -912,11 +912,16 @@ def direct_insert_all_keys(
912912
) -> None:
913913
dst_table = table_name_builder.dst_table(clickhouse_table)
914914
src_table = table_name_builder.src_table(clickhouse_table)
915+
settings = ''
916+
# Large variant details inserts may OOM
917+
if clickhouse_table == ClickHouseTable.VARIANT_DETAILS:
918+
settings = 'SETTINGS max_insert_threads = 2'
915919
logged_query(
916920
f"""
917921
INSERT INTO {dst_table}
918922
SELECT {clickhouse_table.select_fields}
919923
FROM {src_table}
924+
{settings}
920925
""",
921926
)
922927

0 commit comments

Comments
 (0)