For a mass insertion into a database I would recommend neither approach. Instead I would suggest learning what native tools your database has for mass inserts. I would then use them.
in reply to Re: When to use forks, when to use threads ...?
in thread When to use forks, when to use threads ...?
...If the table you're inserting into has indexes I would strongly suggest dropping all indexes,...
That doesn't work as needed, unfortunately. It's not a simple insertion, but rather an insert-or-update-if-already-there process. So I cannot disable indexes either. Parallelizing the process in some way seemed the most appealing alternative to speed up things.