Hi Uma,
Try to avoid use of ' FOR ALL ENTRIES '. For all entries will reduce your performance. In For all entries for every single entry it will search the entire table.
For imagine tab1 and tab2. tab1 have 10000 entries and tab2 have 5000 entries. If you have fired select query on tab1 for all entries on tab2 then 10000*5000 times it will search.
Instead of FOR ALL ENTRIES try to fetch data from tab1 and then delete the entries which are not in tab2.
Regards
M Nair