Someone told me recently that any country can easily link a new passport number to a previous passport issued to the same person, say when processing a visa application or something, as if there were some international system that would allow this. If it is true, it's creepy and Orwellian, but I think it is not true and that the only information a visa application service would have about anyone's travel history is the information the applicant gives them. But I'm really not at all sure about how all this travel data is actually managed and shared so I thought I'd ask.
How much data sharing between countries is done is unknown. The USA State Department can’t even get its computers to talk properly with the USA Department of Homeland Security, so a superdatabase that tracks everyone everywhere in the world is unimaginable at the current moment.
However, you should always act and assume that they can or do know or can find out (or will know in the future), and answer all questions put forward by an immigration officer truthfully. That’s not to say you should proffer information, just that you shouldn’t lie.
Immigration doesn’t have to actually torture you but it’s within their capacity to detain you, hold you, question you, access your laptop and smartphone, and other things until you reveal what they want to know from you.