Unanswered: I need a better performance query for a simple situation
I have two tables A (IdA, Field1) and B (IdB, Field2).
The join can be done with A.field1 = B.Field2. Field1 and Field2 are varchar(14).
Table A has 1.312.241 rows and table B has 5000 rows.
I would like to delete on table A the rows where A.field1 doesn´t exist on table B.Field2.
When i´ve tried the follow query it keeps runing for more than 10 minutes and i don´t have the delete finished:
DELETE FROM A where Field1 not in (select Field2 from B);
Can anyone tell me another query that i could use instead with better performance?