I have a table(table1) which has id as the primary key and incremental in nature. The table has Updatedtm which has the last updated date and time. The table has around 300 million records. I have another table table2 which is in sync with table1. What is the best way to delete from table2 when an id is removed from table1? Is Left join an efficient way, do i have to compare 300 million records everytime to check for deletes?
Delete from table2
where id not in(Select id from table1)