Re: How many Statements to batch
- From: "Robert Klemme" <bob.news@xxxxxxx>
- Date: Thu, 26 Jan 2006 14:35:34 +0100
Ellarco wrote:
> I am performing millions of inserts using PreparedStatements and
> executing them in batches. My question is simply how big should my
> batch be?
IMHO there's no general answer to this as this depends on the driver, the
JVM, amount of mem you have available, the database engine, resources on
the db server, DDL, indexes...
> Im assuming that attempting to batch millions of them at a time is
> bad from a GC point of view ... they are going to be taking up memory
> for long periods of time (until the batch "is full") causing the GC
> to lots of slow full (old-generation) collections.
There's a completely different set of problems: if your batch grows too
large, the database transaction handling might choke. The larger your
batches the more likely that you reach limits on the rollback segments
(Oracle) or run into locking issues.
> So has anyone got any research/experience that suggests an upperlimit
> on batch size? Or perhaps its better for the batch to be executed
> periodically rather than when a certain number of statements have
> been added?
This is a typical optimization task. I'm afraid you'll have to measure
your performance and find out the optimum for *your* application case. I
guess the range will be between 100 and several tenthousands - but this is
just a wild guess.
Kind regards
robert
.
- Follow-Ups:
- Re: How many Statements to batch
- From: Roedy Green
- Re: How many Statements to batch
- From: Ellarco
- Re: How many Statements to batch
- References:
- How many Statements to batch
- From: Ellarco
- How many Statements to batch
- Prev by Date: How many Statements to batch
- Next by Date: Re: How many Statements to batch
- Previous by thread: How many Statements to batch
- Next by thread: Re: How many Statements to batch
- Index(es):
Relevant Pages
|
|