Speed things up by using transactions.

Now it looks like it'll finish in about four hours.  Maybe not as fast
as I'd hoped, but reasonable.