Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 794D663296B for ; Fri, 11 Dec 2009 11:32:48 -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 91656-04-7 for ; Fri, 11 Dec 2009 15:32:26 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id DC356634902 for ; Fri, 11 Dec 2009 11:26:34 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id nBBFQQiO017893; Fri, 11 Dec 2009 10:26:26 -0500 (EST) To: Craig Ringer cc: Oliver Jowett , John R Pierce , pgsql-jdbc@postgresql.org Subject: Re: Connection.setReadOnly() In-reply-to: <4B225922.1090705@postnewspapers.com.au> References: <4B21737B.50009@hogranch.com> <4B219025.5070607@hogranch.com> <4B219538.2090203@opencloud.com> <4B2198E4.5090306@hogranch.com> <4B219D76.1080600@opencloud.com> <4B225922.1090705@postnewspapers.com.au> Comments: In-reply-to Craig Ringer message dated "Fri, 11 Dec 2009 22:37:22 +0800" Date: Fri, 11 Dec 2009 10:26:26 -0500 Message-ID: <17892.1260545186@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.547 tagged_above=-10 required=5 tests=AWL=0.052, BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 200912/24 X-Sequence-Number: 20105 Craig Ringer writes: > Does Pg have issues with long-running read-only transactions in > read-committed mode? Or are they an exception to the usual "avoid > long-running mostly-idle transactions" guideline? > Pg doesn't have to worry about retaining old rows in vacuum with such a > statement, because each new statement creates a new snapshot, so if it's > idle it effectively has _no_ snapshot and vacuum is free to clear old > rows. It doesn't need to keep track of anything to roll back, since the > transaction is read only. As of 8.4, I think the above statements are true. In prior releases, transactions just advertised the age of their first snapshot, so an open transaction created an issue for VACUUM regardless of whether it was serializable or not. 8.4 has more bookkeeping that allows a transaction to report that it currently has no live snapshots. regards, tom lane