Wanting to overfit model to say if data has been seen before
I'm not sure if a machine learning approach is a good choice for such a task. I am tempted to say no. The reason is mainly, that ML usually is used for the discovery of patterns or in other words of similarities while they are designed to generalize so they still recognize a pattern even if it looks different due to some randomness (noise etc.).

In your case however it sounds more like you want to discover exact matches.

You also have to consider, that you cannot store your data in an arbitrarily compact form without reducing information. So even if you would find a suitable ML model for your purpose, you cannot expect it to consume much less space as the part of the database for which you want to find matches in the other database.