In my application requirement is to find the difference data between 2 tables (Both tables are with same structure) and store that difference data to another table
Let say source table name is T_S, target table is T_T and difference table is T_D.
To do this there are 3 queries written, they are
1) insert into T_D (select * from T_S),'INSERTS' where data not in T_T;
This query to find inserts
2) insert into T_D (select * from T_T), 'DELETES' where data not in T_S;
This query is to find deletes
3) insert into T_D (select * from T_S),'UPDATE' where (data of T_S) != (data of T_T);
This query is to find updates
These queries are taking more than an hour to execute, Is there any other way to achieve this problem OR any other way of writing these queries efficiently ? ?
Thanks,
divi