Change "insert" into "replace" for select statement.
Don't know why we did not hit this before. Maybe the node_usage DB got into an odd state recently where there were some extra records? Who knows. I compared the .dat files produced from old and new and all the historic records that this script produces are the same.
Showing with 4 additions and 4 deletions