Batch Limit
Hi,
I have to perform multiple updates on a table based on ids. To avoid multiple DB hits, I am using PreparedStatement's Batch. I wanted to know the number of statements that can be added to the batch without performance hit or any other issue. I am talking about 1000, 5000, 10000 or more.
Thanks in advance.
[330 byte] By [
mod_pa] at [2007-11-27 8:22:44]

# 4
> I wanted to know the
> number of statements that can be added to the batch
> without performance hit or any other issue.
"Without ANY performance hit or ANY other issue"? Then the answer is somewhere around 1, otherwise you risk grabbing more resources then you would without using batch which could in theory destabilize your application and/or change the performance characteristics of your application.
On my production system, I found that 3,000 provided better performance then less then 3,000 and better stability then more then 3,000. It was the balancing point on my system, but your DBMS could be setup quite differently, and your SQL could use different resources. Therefore that value has very little meaning to anyone other then me.
Because "it depends" you need to try it on your system and see what value works best for you.
Best of luck.