Thanks to Nathan Elliott for updating his Event Histograms ZenPack. After his work in this thread, I rewrote the query and the script to reduce the number of shell and SQL calls the ZenPack was making.
Thanks Nathan!