結果如下:
Use SqlServer DataAdapter Insert;RecordCount:40000;BatchSize:10;Time:21569;
Use SqlServer DataAdapter Insert;RecordCount:40000;BatchSize:20;Time:19607;
Use SqlServer DataAdapter Insert;RecordCount:40000;BatchSize:50;Time:19647;
Use SqlServer DataAdapter Insert;RecordCount:40000;BatchSize:100;Time:18649;
Use SqlServer DataAdapter Insert;RecordCount:40000;BatchSize:200;Time:21823;
測試的結果讓我比較失望,SqlDataAdapter會爲每個修改行發送一條T-SQL命令,所以效率並不高。
而且再其他的方式中,都可以進行異步處理,SqlDataAdapter的Update()方法並不支持異步的結果,所以此方法不推薦
全文鏈接:
.NET批量大數據插入性能分析及比較(2.普通插入與拼接sql批量插入)
.NET批量大數據插入性能分析及比較(4.使用DataAdapter批量插入)