X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 92EFB9DC846 for ; Sat, 21 Jan 2006 20:50:44 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 84632-07 for ; Sat, 21 Jan 2006 20:50:48 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 71A2F9DC80A for ; Sat, 21 Jan 2006 20:50:42 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id k0M0og30002755; Sat, 21 Jan 2006 19:50:42 -0500 (EST) To: Bruno Wolff III cc: Jaime Casanova , Chris Hoover , Michael Fuhr , "pgsql-admin@postgresql.org" Subject: Re: What happens to transactions durring a pg_dump? In-reply-to: <20060122002519.GA20969@wolff.to> References: <1d219a6f0601090922s5224e78emd68cf850b836c2af@mail.gmail.com> <20060109174511.GA43775@winnie.fuhr.org> <1d219a6f0601091000u45439e1dq1eb8296e8ffa3dba@mail.gmail.com> <20060122002519.GA20969@wolff.to> Comments: In-reply-to Bruno Wolff III message dated "Sat, 21 Jan 2006 18:25:19 -0600" Date: Sat, 21 Jan 2006 19:50:42 -0500 Message-ID: <2754.1137891042@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.095 required=5 tests=[AWL=0.095] X-Spam-Score: 0.095 X-Spam-Level: X-Archive-Number: 200601/257 X-Sequence-Number: 20345 Bruno Wolff III writes: > I don't think that is precisely correct. I believe that the snapshot isn't > set until the first query is made within the transaction. Right. Specifically, any statement *other* than those enumerated in PortalRunUtility() will set the snapshot. As of CVS tip (and for several past releases IIRC), that code looks like: /* * Set snapshot if utility stmt needs one. Most reliable way to do this * seems to be to enumerate those that do not need one; this is a short * list. Transaction control, LOCK, and SET must *not* set a snapshot * since they need to be executable at the start of a serializable * transaction without freezing a snapshot. By extension we allow SHOW * not to set a snapshot. The other stmts listed are just efficiency * hacks. Beware of listing anything that can modify the database --- if, * say, it has to update an index with expressions that invoke * user-defined functions, then it had better have a snapshot. */ if (!(IsA(utilityStmt, TransactionStmt) || IsA(utilityStmt, LockStmt) || IsA(utilityStmt, VariableSetStmt) || IsA(utilityStmt, VariableShowStmt) || IsA(utilityStmt, VariableResetStmt) || IsA(utilityStmt, ConstraintsSetStmt) || /* efficiency hacks from here down */ IsA(utilityStmt, FetchStmt) || IsA(utilityStmt, ListenStmt) || IsA(utilityStmt, NotifyStmt) || IsA(utilityStmt, UnlistenStmt) || IsA(utilityStmt, CheckPointStmt))) ActiveSnapshot = CopySnapshot(GetTransactionSnapshot()); else ActiveSnapshot = NULL; regards, tom lane