いくつかの提案があります。
1) 書き込み中のデータベースのデータベースとログ ファイルの両方に、書き込み中のデータを収容するのに十分な空き領域があることを確認します。データベースの動的なサイズ変更は、SQL Server にとって非常にコストのかかる操作であり、サイズ変更のパーセンテージが小さい小さなデータベースから始めると、サイズを継続的に変更することになります。
2) 挿入コマンドをトランザクションでラップします。これにより、速度が大幅に向上するはずです。1 回のトランザクションで 80,000 レコードすべてをラップすることはおそらくできませんが、一度に 1000 程度を試すことはできます。擬似コード:
Const MAX_RECORDS_PER_LOOP = 1000
Dim Counter As Integer
Dim trans As SqlTransaction
Try
For Each record In File
' If we are not in a transaction, enter one
If trans Is Nothing Then
trans = conn.BeginTransaction()
End If
' Do your insert
' Boost the counter
Counter += 1
' We have reached the max
If Counter = MAX_RECORDS_PER_LOOP Then
' Commit the previous batch and reset the values
trans.Commit()
trans = Nothing
Counter = 0
End If
Next
' Commit the last batch, if any
If trans IsNot Nothing Then
trans.Commit()
End If
Catch theException As Exception
' Report the exception
' Rollback if trans in progress
If trans IsNot Nothing Then
trans.Rollback()
End If
End Try