Are you running h2 in embedded mode, or are you connecting to an h2
server?

The overhead for getting the next value for a sequence in h2 is almost
zero if you in embedded mode. It's probably not worth optimizing it if
your running in embedded mode.

It used to be slower to do batch updates in h2 in server mode. I'm not
sure if it's still true.

Brish

On Aug 28, 1:07 pm, Richard <[EMAIL PROTECTED]> wrote:
> Just started playing with H2 - looks great, thanks.
>
> Some code I am porting over relies on being able to jump a sequence's
> value bigger than the default value (in my case, 1).  In particular, I
> am using this when I am doing a batch insert:
>
> 1.  maxKeyValue = update the sequence by (number of new records)
> 2.  Loop over new records: batch inserts setting the primary key (int)
> to maxKeyValue--
>
> In other words, I do a single big increment on the sequence to avoid
> repetitively calling it before each batch insert. I have yet to find
> the syntax to accomplish the same trick with H2.  I found something to
> do with issuing an alter sequence command that may do it, but wasn't
> sure if that was a hack or not.
>
> I'd prefer to rely on an auto increment on the primary key (its an
> int), but my understanding is that with batch updates I will not be
> able to do statement.getGeneratedKeys() to return ids of new records
> that were inserted.  Please say this is possible :)
>
> Thanks,
> Richard
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to