Data sync from API, what's the best method?

I’m working on getting data from an API, to insert records into the DB.

I would like to get data every minute, making sure that after getting the data all records are synchronised.

Right now I’m thinking to do this:

  1. Get the Data
  2. Compare the API records with records in DB
  3. Insert modified / new records in DB
  4. Delete records in DB that are not in the API records

This seems to be very “heavy” to do every minute though.

Anyone any recommendations on the best “algorithm” for this case?

Community Page
Last updated: