Sample Header Ad - 728x90

Delete using join or using sub-query?

2 votes
1 answer
925 views
I need to delete rows from a table based on what is present in a temporary table. For me, both of these statements work : DELETE from main_table where id in (select deletable_id from temporary_table); and DELETE main_table from main_table join temporary_table on main_table.id = temporary_table.deletable_id; Which of the two is advisable to use given the fact that main_table will be having a billion of rows and the temporary will have a few thousands.
Asked by gaganbm (141 rep)
Jun 12, 2015, 11:51 AM
Last activity: Aug 1, 2025, 05:03 PM