OLEDB slow when executing against access database on network drive
I'm exporting data as rows in an access database located on a network drive. Currently, I use the following c# code:
using(OleDBCommand oleDBCommand = new oledbcommand(insertstring,conn))
{
OleDbParameter param = new OleDbParameter();
param.ParameterName = " .. ";
oleDbCommand.Parameters.Add(param);
....
....
....
foreach(Row row in rows)
{
oleDBCommand.parameters.add["asd"].value= row.o;
....
....
oleDCCommand.executenonquery();
}
}
which takes abou开发者_StackOverflow社区t a minute to export 100000 rows. But when exporting to a database located on a network drive, it takes about an hour. What is causing this hickup, and how to solve it?
I'm using Microsoft.ACE.OLEDB.12.0 EDIT: Network drive is pretty fast, in the sense that moving a 100 mb file from local to network takes in the order of minutes.
Given the evidence, there is no answer except network latency. What I would suggest is that you try smaller batches locally and on the network drive, and see how they perform. For example, try batches of 100, 1000, and then 10000 and compare the numbers. If the difference scales linearly, i.e., if the network drive is always sixty times slower, then it's latency. If it runs twice as slow until you hit a certain number (or maybe even a certain record), then it's something else, like a buffer being exhausted, or something else.
Hope this helps.
精彩评论