I have a document with 3 million lines that I have to process and then insert into a table on a database. The database connector class have an insert and an update that receive the data and then make the operation. The insert and update work perfectly.
The problem is that I want to split this modifications to the database to avoid overloading the DB. Ideally I would love to make automatic splits of n lines of arrFinal and then manage each part separately. But I don't know how to do this.
This is the foreach I have right now:
ConnectDB cdb = new ConnectDB();
foreach (string s in arrFinal)
{
if (s.Split(';')[1] == "REQUEST")
{
cdb.Insert(s.Split(';')[0], s.Split(';')[2], s.Split(';')[3], s.Split(';')[4], s.Split(';')[5], dateLog);
}
else if (s.Split(';')[1] == "RESPONSE")
{
cdb.Update(s.Split(';')[0], s.Split(';')[5]);
}
}
In case you wonder how data comes:
00:00:00.7443;REQUEST;POST;https://ulrName/Prices/;/1_0/962;https://ulrName/Prices/1_0/962
00:00:00.7793;RESPONSE;POST;https://ulrName/Prices/;/1_0/962;https://ulrName/Prices/1_0/962
Thank you in advance for your help. I'm open to try any approach to get this right.