How would you optimize a SQL transformation that processes billion-row tables in a warehouse at BHG Financial?