Right now it always logs the queries, and is probably slowing down the script. Turn logging off by default, but let it be turned on with a -v flag.