X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 93C67529E2 for ; Thu, 21 Jul 2005 12:41:11 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 90715-06 for ; Thu, 21 Jul 2005 15:41:01 +0000 (GMT) Received: from smtp.iquer.net (smtp.iquer.net [195.234.230.108]) by svr1.postgresql.org (Postfix) with ESMTP id 83C5E52AB3 for ; Thu, 21 Jul 2005 12:41:00 -0300 (ADT) Received: from sponts0.iquer.net (sponts0.int.iquer.net [10.0.8.10]) by smtp.iquer.net (Postfix) with SMTP id 2068F11E6F8 for ; Thu, 21 Jul 2005 17:40:59 +0200 (CEST) Received: from smtp.iquer.net (sv8.int.iquer.net [10.0.11.80]) by sponts0.iquer.net (SPONTS v2.1.80) with ESMTP id 1053A0DFB3D-0 for ; Thu, 21 Jul 2005 17:40:59 +0200 Received: from ws1.int.iquer.net (ws1.int.iquer.net [10.0.16.220]) by smtp.iquer.net (Postfix) with ESMTP id F3FE110A71A for ; Thu, 21 Jul 2005 17:40:58 +0200 (CEST) From: Erik Wasser To: pgsql-sql@postgresql.org Subject: Re: Are long term never commited SELECT statements are a problem? Date: Thu, 21 Jul 2005 17:40:57 +0200 User-Agent: KMail/1.8.1 References: <200507211557.58822.erik.wasser@iquer.net> <20050721151811.GA513@winnie.fuhr.org> In-Reply-To: <20050721151811.GA513@winnie.fuhr.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200507211740.57999.erik.wasser@iquer.net> X-SPONTS-Version: 2.1.80 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200507/182 X-Sequence-Number: 22160 On Thursday 21 July 2005 17:18, Michael Fuhr wrote: > If you set AutoCommit to 0 then all statements are inside a > transaction. As you've discovered, SELECT acquires certain locks > that persist for the duration of the transaction, so you must commit > or roll back the transaction to release those locks (read up on > transaction theory to learn more about the rationale for this). What URL should I read at first? I began with 'http://www.postgresql.org/docs/8.0/interactive/transaction-iso.html'. Is this the right page for starters? BTW: I quote from the page: > When a transaction is on the serializable level, a SELECT query sees > only data committed before the transaction began; it never sees either > uncommitted data or changes committed during transaction execution by > concurrent transactions. (However, the SELECT does see the effects of > previous updates executed within its own transaction, even though they > are not yet committed.) So I opened up two shells and started 'psql' on both shells (marked the command with 1 and 2): 1:begin 2:begin; 1:SELECT * FROM test; id | name ----+------ (0 rows) 2: INSERT INTO test (name) VALUES ('foo'); 1: SELECT * FROM test; id | name ----+------ (0 rows) 2: commit; 1: SELECT * FROM test; id | name ----+------ 1 | foo (1 row) Why do I see in the first transaction data from the commited second transaction? Doesn't prove that the documentation on the above URL wrong? -- So long... Fuzz