How would you optimize a slow-running SQL query that is pulling data from a large healthcare transaction database?