Itransition interview question

How to optimize database queries