如何查找设置UpdateBatchSize时的UpdateBatchSize

2023-09-06 14:50:27 作者:野性且迷人

我有一个.NET应用程序被合并两个数据表有很多行(10000)的。有具有大量的更新的一个很好的机会/插入使用DataAdapter.Update命令何时执行到SQL表

I have a .NET application that is merging two datatables with a lot of rows (10,000+). There is a good chance of having a large number of update/inserts to perform to the SQL table when using the DataAdapter.Update command.

现在,我有适配器UpdateBatchSize属性设置为200 VS警告不要设置这个值过高,因为这样可能会降低性能。好吧,疑难杂症。

Right now, I have the Adapter UpdateBatchSize property set to 200. VS warns against setting this value too high because it may decrease performance. Ok, gotcha.

在性能方面,我应该怎么看这个属性进行的呢?不管是什么,更新大量的行会需要大量的时间。我的机器(或数据库服务器)上运行它不会-seem-采取了很多时间,但我相信当系统装下去做其他项目,这可能是一个问题。

Performance wise, what should I look for when setting this property? No matter what, updating lots of rows will take a bunch of time. Running it on my machine (or on the DB server) doesn't -seem- to take that much time, but I am sure when the system is loaded down doing other items, this may be an issue.

有什么我可以看看在探查?做一个标准的分析,持续时间通常为0有时打1或2(也许20次顺位),并从约20,000更新,3-4打20的CPU为0除了一对夫妇的打1-2 。有2条是上升到读10左右。总是2和写入,始终为0。

Is there something I can look for in the Profiler? Doing a standard profiling, the Duration is usually 0. Sometimes is hits 1 or 2 (maybe 20 times overall) and out of about 20,000 updates, 3-4 hit 20. CPU is at 0 except for the a couple that hit 1-2. There are 2 records that go up to around 10. Reads are always 2 and Writes are always 0.

推荐答案

第一件事情就是我会做这个设定配置的,因此您可以在不编译测试各种数值。接下来的事情就是看你整批的持续时间。如果您满意的性能不改变它。如果与性能的不愉快尝试和增加或减少的设置,看看它是如何的表现。

First thing is I'd make this setting configurable so you can test various values without compiling. The next thing is to watch the duration of your entire batch. If your happy with the performance don't change it. If your unhappy with the performance try and increase or decrease the setting to see how it behaves.

相关推荐