I want to compare two big tables if they are identical. If I update/insert one table into the other the process takes about 11 hours.

What I am looking for is like a sum function which sum ups a key for each row and then I would like to compare the two sums. I guess I would need to take every of the 40 columns into that key to be sure they are exactly the same.

Any idea how to do this quick? Ah I forgot one big thing: these tables are on different systems stored in different DMS. The source is DB2 and the copy is MySQL.

I read about the Checksum function in MySQL. - I also read, that it somewhat restricted to MyISAM - I reade that two tables with the same checksum could still have no identical content. -> might not be what I am looking for. Other ideas are apprechiated.

  • If you can export both as CSV (maybe explicitly ordered by the PK or something), then just DIFF them. – jkavalik Jan 5 '16 at 13:48
  • Exporting to CSV, then using LOAD DATA would probably have decrease the transfer time significantly. – Rick James Jan 5 '16 at 19:26
  • Thank you very much for your responses. How would you DIFF the two very large CSV files? – Robi Wan Kenobi Jan 7 '16 at 13:44
  • With any diff tool, the commandline one might be well suited as afaik it does not load everything in memory. – jkavalik Jan 13 '16 at 8:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.