Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 6E46D63386A for ; Thu, 5 Nov 2009 10:33:47 -0400 (AST) 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 23271-09 for ; Thu, 5 Nov 2009 14:33:28 +0000 (UTC) X-Greylist: delayed 00:05:05.748974 by SQLgrey-1.7.6 Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.17.10]) by mail.postgresql.org (Postfix) with ESMTP id 8FF646336E0 for ; Thu, 5 Nov 2009 10:33:36 -0400 (AST) Received: from [192.168.1.3] (pool-96-244-14-10.bltmmd.fios.verizon.net [96.244.14.10]) by mrelayeu.kundenserver.de (node=mrbap2) with ESMTP (Nemesis) id 0MF9xL-1Mulrc2Ew7-00GU8Z; Thu, 05 Nov 2009 15:28:22 +0100 Message-ID: <4AF2E0FF.5050702@2ndquadrant.com> Date: Thu, 05 Nov 2009 09:28:15 -0500 From: Greg Smith User-Agent: Thunderbird 2.0.0.23 (X11/20090817) MIME-Version: 1.0 To: Craig Ringer CC: Dave Crooke , pgsql-performance Subject: Re: Followup: vacuum'ing toast References: <4AF229F5.201@2ndquadrant.com> <4AF24006.1010509@postnewspapers.com.au> In-Reply-To: <4AF24006.1010509@postnewspapers.com.au> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V01U2FsdGVkX19LTvKjYN8wSSWt2u81xBl265/Mima4n+9uqUM 4Ngkn3BVhmn3LNhbVhsSTKmltdsC8BkUjnjAaoPmfrZwR/+wQN /qIx++GMEdn3gKMhJDCpcEFoWoP1iKT 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: 200911/70 X-Sequence-Number: 36238 Craig Ringer wrote: > Hibernate is pretty well behaved with transaction management. In fact, > it's downright nuts about keeping transactions open for as short a > period of time as possible. It even implements its own row-versioning > based optimistic locking scheme (oplock) rather than relying on holding > a transaction open with row locks in the database. > It's probably more nuts than it needs to be with PostgreSQL as the backing store, since MVCC prevents some of the common sources of row locks from being needed. But since Hibernate is database-agnostic and it worried about locally cached copies of things too, it ends up needing to do this extra work regardless. > 3) Autocommit being disabled. At least when using Hibernate via JPA, > that'll cause a major mess and would easily explain the issues you're > seeing. Hibernate manages transactions explicitly when required, and > expects autocommit to be off. > Downthread it suggests there's still some confusion here, but everyone should be clear about one thing: turning autocommit on is the first step down a road that usually leads to bad batch performance. If your problems go away by enabling it, which they sometimes do, that is a sign there's a problem to be investigated, not a true solution. One day you're going to find yourself wanting transactions to be explicitly committed only when required, both for atomicity and performance reasons, and you won't be able to rely on autocommit as a crutch at that point. Better to never get used to be there in the first place. -- Greg Smith greg@2ndquadrant.com Baltimore, MD