Skip to content

Commit

Permalink
Speed up BQ by having 2 queries, and not an OR (#27981)
Browse files Browse the repository at this point in the history
  • Loading branch information
evantahler authored Jul 5, 2023
1 parent 308422e commit 151e675
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,10 @@ String dedupFinalTable(final StreamId id,
) as row_number FROM ${final_table_id}
)
WHERE row_number != 1
)
OR (
);
DELETE FROM ${final_table_id}
WHERE
${pk_list} IN (
SELECT (
${pk_cast_list}
Expand All @@ -386,8 +388,7 @@ String dedupFinalTable(final StreamId id,
JSON_QUERY(`_airbyte_data`, '$._ab_cdc_deleted_at') IS NOT NULL
AND JSON_TYPE(JSON_QUERY(`_airbyte_data`, '$._ab_cdc_deleted_at')) != 'null'
AND ${cursor_name} < ${cursor_cast}
)
);""");
);""");
}

@VisibleForTesting
Expand Down

0 comments on commit 151e675

Please sign in to comment.