pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: rawi <only4com@web.de>
To: pgsql-sql@postgresql.org
Subject: Re: Hibernate, web application and only one sequence for all primary keys
Date: Thu, 17 Sep 2009 07:47:13 -0700 (PDT)
Message-ID: <25491924.post@talk.nabble.com> (raw)
In-Reply-To: <4AB23593.4090906@beecom.ch>
References: <25490498.post@talk.nabble.com>
	<4AB23593.4090906@beecom.ch>



Leo Mannhart wrote:
> 
> Caveat: If you use the standard sequence generator in hibernate, it is
> not using the postgres-sequence in the "usual" manner. hibernate itself
> caches 50 ID's as sequence numbers by default. This means, hibernate
> only does a select on the database sequence every 50 numbers. it
> multyplies the database sequence by 50 to get the "real" sequence
> number. it generates the sequence numbers in blocks of 50 numbers or
> according to the sequence cache size.
> That said, you would probably not see any performance bottlenecks
> because of the sequence number generator in the database, even with
> thousands of inserts per second.
> 

Hi Leo, thank you for the explanation!

I don't know if it is that cool to lose up to 50 IDs on each session-end of
Hibernate...
And what do you suppose it would happen, if I set the cache size of
Hibernate's own sequence (after generation) by hand to 1 instead of 50? I
wouldn't need tausends of inserts per second...

Kind regards, Rawi

-- 
View this message in context: http://www.nabble.com/Hibernate%2C-web-application-and-only-one-sequence-for-all-primary-keys-tp2549...
Sent from the PostgreSQL - sql mailing list archive at Nabble.com.




view thread (12+ messages)  latest in thread

Message-ID: <25491924.post@talk.nabble.com>
Permalink:  ../25491924.post@talk.nabble.com/
Also on:    postgresql.org/message-id/25491924.post@talk.nabble.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: only4com@web.de
  Subject: Re: Hibernate, web application and only one sequence for all primary keys
  In-Reply-To: <25491924.post@talk.nabble.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox