dramatically optimizing query with gross SQL.