Amazon interview question

System Design question regarding a query service