A lot would depend on whether the countries share data, whether you actually use both passports, and how you use them.
By now, governments have noticed that one person can have alternative names, so merely matching on name, qualified by date and place of birth, is not good enough. There is a general and increasing trend to depend on biometrics, typically some combination of fingerprints and photographs that allow analysis of the structure of the person's face.
For example, if you enter the US on a non-US passport, DHS collects fingerprints and a photo, with a few exceptions such as diplomats and children.