Describe the process of optimizing a slow-running database query in a high-traffic environment at Match group.