Commit frequently, say after evrey 1000 odd rows.