Finding Duplicates in a Customer MDM with a Billion Records

Nikolay (@nivolg)1 Oct 2024

Problem

A large Russian bank had to load the customer records of an acquired bank into its master data management (MDM) system and have a working deduplication service in three months. Both banks keep customers in several systems with no shared ID, so the same person appears many times and the overlap between the two customer bases may reach 10%. Typos, placeholder values and look-alike people (twins, namesakes) make simple matching unsafe. All-pairs comparison is quadratic, and a wrong merge can show one customer another's accounts.

Example from the article: a million records in each base means a trillion comparisons, almost 12 days at 1 microsecond each, while the business needs minutes.

Solution in brief

Normalize names and addresses first. Then give each record several hash values, store them in a Lucene inverted index, and compare a record only with the few candidates that share a hash. Candidates pass through rule comparators scored 0 to 100. JGroups splits the work across servers.

Questions this case answers
  • How to find duplicate records in a very large table without a quadratic all-pairs comparison when a wrong merge is costly and decisions must be explainable
  • How to keep a deduplicated entity base current as records change, with a batch pass, an incremental pass and a sub-second lookup for new records
  • How to find duplicate customer records across tens or hundreds of millions of rows without comparing every record with every other?
  • How to avoid merging two different people who share many attribute values?

Tools and methods

  • Apache Lucene — inverted index of hash values in RAM (MMAP); full records read from disk only for candidates.
  • Hash-based blocking — Java hashCode() over normalized strings builds the candidate groups.
  • Rule-based comparators — XML scenarios with a match coefficient from 0 to 100.
  • lz4 compression — applied to single records instead of the whole file.
  • JGroups — finds servers and builds dynamic clusters for master and slave work.
Continue reading — it's free

Google or a one-time email code. No password.