Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 5EB95632732 for ; Thu, 17 Sep 2009 11:47:25 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 32034-02 for ; Thu, 17 Sep 2009 14:47:05 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from kuber.nabble.com (kuber.nabble.com [216.139.236.158]) by mail.postgresql.org (Postfix) with ESMTP id C95C1632545 for ; Thu, 17 Sep 2009 11:47:14 -0300 (ADT) Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1MoIGP-0004mM-6N for pgsql-sql@postgresql.org; Thu, 17 Sep 2009 07:47:13 -0700 Message-ID: <25491924.post@talk.nabble.com> Date: Thu, 17 Sep 2009 07:47:13 -0700 (PDT) From: rawi To: pgsql-sql@postgresql.org Subject: Re: Hibernate, web application and only one sequence for all primary keys In-Reply-To: <4AB23593.4090906@beecom.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: only4com@web.de References: <25490498.post@talk.nabble.com> <4AB23593.4090906@beecom.ch> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 200909/77 X-Sequence-Number: 33142 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-tp25490498p25491924.html Sent from the PostgreSQL - sql mailing list archive at Nabble.com.