c# - database update performance seems terrible. Did I do something wrong? -
i have table in sqlserver 2008 r2 express, has little more 3 million records. need processing on each record: take value 1 field input, process , fill result field.
since processing written in c#, decided use sqladatper , datatable update each record , update database, follow http://msdn.microsoft.com/en-us/library/33y2221y.aspx. tested on smaller table 700,000 records. not take time read data , finish processing takes forever update table, around 100 records per second, extremely slow. tried changing updatebatchsize not , throw out time out exception if updatebatchsize>=1000.
next thought maybe problem sqladapter , datatable. use sqlreader read table , update sqlcommand inside loop update record, performance still terrible (i use parameters update statement , prepare sqlcommand). thought maybe should combine update statements , run them in batch not performance either.
finally decide read data database, write result text file, load text file database , write simple update sql. lighting fast comparing using c# update. doing wrong?
the more depressing thing export data access, compile processing c# module dll can used in vba, , write update statement, like, update table set field2 = processing(field1), , lighting fast.
Comments
Post a Comment