What steps would you take to diagnose a slow-running query that processes millions of records at Mphasis?