Move the insert logging out of the main loop

Because with postgres it is blocked by the pending COPY command
held by the inserter.
Remove commented-out code