How would you optimize a slow-running SQL join query that involves a massive transaction table and a smaller dimension table?