Ok, a weird thing happened. I gave up on the batch insert, went to a friend's
house to drink some scotch, came back and tried it again and the whole insert
took 5 minutes. That's _much_ more reasonable.
Now it was late at night and I wasn't necessarily completely sober but I'm
pretty sure _nothing_ had changed. I can only imagine somehow the query was
frozen trying to grab a lock on something. Only nothing else was running and
it was consuming an awful lot of cpu for something trying to acquire a lock.
For what it's worth I tried it with the constraints removed using alter table.
It took 10 seconds to do the entire insert, then a 1m15s to restore each
constraint. (Can I restore them together? would it be faster?) So that's
faster but only by a factor of 2.
--
greg