Apple | Phone | Adding billions of records with limited space | Failed seeking solution

Difficulty: MEDIUMCategory: InterviewExperienceFrequency: 1Asked On 2020-05-19Added By Anonymous
Source: Link

Question: Assume you have a DB with limited storage which contains some data already and you have almost a Billion records to store, You are given a bunch of updated data. New data can contain some of old data with updated versions or new data. You have to return what kind of operation you would perform on new data. Important part *** "What if there are a billion records"***


Example (Assume data is like a key value pair and value is a version)

given data a1,b1,c1, e1

New Data a2, b1,c2,d1


Answer : update: a

update :c,

insert: d1

delete e, since e is not present in new data


Goal is to reduce DB calls

Any idea how to solve it ?

Comments