I had my Gmail account checking another (non-Gmail) account, with "leave a copy of retrieved message on the server" option set. 

The provider changed the username format (by adding the @-part). When I updated Gmail settings, it started to fetch thousands of mails since the beginning of times. To stop the insane flow, I had to delete the account from Gmail settings. 

As you have guessed, the old emails retrieved created duplicates and, what is worse, they went in the inbox merging with other emails that I had decided to keep in the inbox. I had to go manually one-by-one to identify emails in the inbox preceding the update and prune the others.

When adding the new account, how can I ask to retrieve only new messages?
   
How does Gmail decide what to fetch and what to leave on the server?