Amazon Interview Question

System Design question regarding a query service