I have 2 tables that I am trying to compare. The tables are the same structure and should be exactly the same with 60,000 entries each. However some entries are different and I would like to find the issues. I am currently trying to do a left join on each of them and show the results. I am currently getting results but it takes 12 min for each Query.
Table 1 (temp_entries)
ID | File
Table 2 (temp_dir_scan)
ID | File
Query 1 (12.25 min)
SELECT A.ID, A.File
FROM temp_entries A
LEFT JOIN temp_dir_scan B ON A.File = B.File
WHERE B.File is Null
Query 2 (12.26 min)
SELECT A.File
FROM temp_dir_scan A
LEFT JOIN temp_entries B ON A.File = B.File
WHERE B.File is Null
Query 3 (11.54 Min)
SELECT A.ID, A.File
FROM temp_entries A
Where A.File not in (select B.File from temp_dir_scan B)
What is the matter? Or what can I do to speed this up? What is a reasonable time to complete this in?
Here are examples of the results.
1|test.txt
2|test2.txt
45|temp.jpg