adsquare interview question

How do you optimize and check SQL queries