in reply to SQL vs Perl table comparing

Perl can handle very big data structures - your constraint will be physical memory.

However, what you are looking to do is what RDBMs are designed to do well. You should use SQL to get the results you want ( this is MySQL dialect, look up the proper syntax for joins on your own system): 1 SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.key = t2.key WHERE t2.key IS NULL 2 SELECT t2.* FROM t1 LEFT JOIN t2 ON t2.key = t1.key WHERE t1.key IS NULL 3SELECT t1.* FROM t1, t2 WHERE t1.key = t2.key AND NOT t1.content = t2.content 4 SELECT t1.* FROM t1, t2 WHERE t1.key = t2.key AND t1.field1 = t2.field1 AND... Of all these, only #3 may be tricky, if you don't have a specific field whose value you can check. But even there I suspect there is a clean SQL solution that will work faster than Perl. If in doubt, benchmark and see how it goes.