today I come to you for inspiration or maybe ideas how to solve a task not killing my laptop with massive and repetitive code.

I have a CSV file with around 10k records. I also have a database with respective records in it. I have four fields inside both of these structures: *destination*, *countryCode*,*prefix* and *cost*

Every time I update a database with this .csv file I have to check if the record with given *destination*, *countryCode* and *prefix* exist and if so, I have to update the *cost*. That is pretty easy and it works fine.

But here comes the tricky part: there is a possibility that the *destination* may be deleted from one .csv file to another and I need to be aware of that and delete that unused record from the database. What is the most efficient way of handling that kind of situation?

I really wouldn't want to check every record from the database with every row in a .csv file: that sounds like a very bad idea.
I was thinking about some time\_stamp or just a bool variable which will tell me if the record was modified during the last update of the DB BUT: there is also a chance that neither of params within the record change, thus: no need to touch that record and mark it as modified.

For that task, I use Python 3 and mysql.connector lib. 

Any ideas and advice will be appreciated :)