How often do you need to run this script? It sounds to me like a one-time job. In that case I don't see a reason to optimize anything.