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.

Reply via email to