There's the "cache" clause that you can use if you create sequences
explicitly:
http://www.postgresql.org/docs/9.4/static/sql-altersequence.html

Similar to Java collection capacities, I wouldn't change the cache size
though, until you notice some contention in production.

I have only Oracle experience in this area, but I can say that one of our
larger bank customers has changed the cache size for < 5 sequences out of
around 800.

Hope this helps,
Lukas

2015-01-15 17:56 GMT+01:00 Robert DiFalco <[email protected]>:

> Right, I have that now, not bigserial but bigint that default to the
> sequence generator. I just didn't know if for many inserts if it is faster
> to use a prefetched "range" of identities. Wasn't sure if Postgres did an
> update for each time a new sequence value is incremented. I also wanted to
> make sure I would not be in bad shape if sometime in the future I needed to
> change to a scheme more like Twitter Snowflake.
>
>
> On Monday, January 12, 2015 at 3:48:34 PM UTC-8, Robert DiFalco wrote:
>>
>> I have a couple of comments with regards to inserting records.
>>
>> With JPA I have a sequence generator. Hibernate uses these like pools so
>> the generator skips a range of values.
>>
>> Here are my questions:
>>
>>     1. Under JOOQ is their a performance advantage in replicating this
>> behavior?
>>     2. If not, should I just change the field default to grab a sequence
>> on insert when the ID is null?
>>
>> If I opt for #2 how do I insert a record and get the generated ID back? I
>> can see how to do it with a create.insert() query but I was hoping to
>> simply insert the JOOQ generated record I already have and that approach
>> does not allow a #returning chain. Then I hoped I could do something like
>> create.insert(TABLE).using(record).returning, etc. But if I do an
>> "insert" call then I cannot use my record as an object. So there is only
>> the long way around (adding calls to #values for each field in the record).
>> But again, I could EASILY be mistaken.
>>
>> If it is recommended that I do #1, does JOOQ have any basic classes for
>> this? Or it is assume I will implement an ID server myself?
>>
>> Thanks!
>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "jOOQ User Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to