You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Andreas Hartmann <an...@apache.org> on 2010/01/05 00:35:27 UTC
Primary key generation in cluster (PostgreSQL)
Hi Cayenne community,
I'm using Cayenne 3.0M6.
Is it safe to use the default primary key generation strategy with
PostgreSQL in a web application cluster, with multiple JVMs accessing
the same database?
IIUC Cayenne fetches the next value from the sequence (which is then
incremented by 20) and uses these 20 keys. So theoretically, no two
Cayenne instances should ever use the same key. Is this assumption correct?
Thanks a lot for any hints and best regards,
-- Andreas
--
Andreas Hartmann, CTO
BeCompany GmbH
http://www.becompany.ch
Tel.: +41 (0) 43 818 57 01
Re: Primary key generation in cluster (PostgreSQL)
Posted by Andreas Hartmann <an...@apache.org>.
Hi Andrus,
Am 05.01.10 09:06, schrieb Andrus Adamchik:
> Yes, it is safe as long as the underlying DB guarantees atomic sequences.
thanks a lot for your quick answer!
Best regards,
-- Andreas
>
> Andrus
>
> On Jan 5, 2010, at 1:35 AM, Andreas Hartmann wrote:
>
>> Hi Cayenne community,
>>
>> I'm using Cayenne 3.0M6.
>>
>> Is it safe to use the default primary key generation strategy with
>> PostgreSQL in a web application cluster, with multiple JVMs accessing
>> the same database?
>>
>> IIUC Cayenne fetches the next value from the sequence (which is then
>> incremented by 20) and uses these 20 keys. So theoretically, no two
>> Cayenne instances should ever use the same key. Is this assumption
>> correct?
>>
>> Thanks a lot for any hints and best regards,
>>
>> -- Andreas
>>
>>
>>
>>
>> --
>> Andreas Hartmann, CTO
>> BeCompany GmbH
>> http://www.becompany.ch
>> Tel.: +41 (0) 43 818 57 01
>>
>>
>
>
--
Andreas Hartmann, CTO
BeCompany GmbH
http://www.becompany.ch
Tel.: +41 (0) 43 818 57 01
Re: Primary key generation in cluster (PostgreSQL)
Posted by Andrus Adamchik <an...@objectstyle.org>.
Yes, it is safe as long as the underlying DB guarantees atomic
sequences.
Andrus
On Jan 5, 2010, at 1:35 AM, Andreas Hartmann wrote:
> Hi Cayenne community,
>
> I'm using Cayenne 3.0M6.
>
> Is it safe to use the default primary key generation strategy with
> PostgreSQL in a web application cluster, with multiple JVMs
> accessing the same database?
>
> IIUC Cayenne fetches the next value from the sequence (which is then
> incremented by 20) and uses these 20 keys. So theoretically, no two
> Cayenne instances should ever use the same key. Is this assumption
> correct?
>
> Thanks a lot for any hints and best regards,
>
> -- Andreas
>
>
>
>
> --
> Andreas Hartmann, CTO
> BeCompany GmbH
> http://www.becompany.ch
> Tel.: +41 (0) 43 818 57 01
>
>