Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WeqgR-0004j7-KB for pgsql-bugs@arkaria.postgresql.org; Mon, 28 Apr 2014 18:53:43 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WeqgR-00014V-3X for pgsql-bugs@arkaria.postgresql.org; Mon, 28 Apr 2014 18:53:43 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WeqgQ-00014P-Fw for pgsql-bugs@postgresql.org; Mon, 28 Apr 2014 18:53:42 +0000 Received: from smtp-outbound-1.vmware.com ([208.91.2.12]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WeqgM-0001pw-53 for pgsql-bugs@postgresql.org; Mon, 28 Apr 2014 18:53:41 +0000 Received: from sc9-mailhost2.vmware.com (sc9-mailhost2.vmware.com [10.113.161.72]) by smtp-outbound-1.vmware.com (Postfix) with ESMTP id 2EFD929FEE; Mon, 28 Apr 2014 11:53:35 -0700 (PDT) Received: from zcs-prod-ext-mta-1.vmware.com (zcs-prod-ext-mta-1.vmware.com [10.113.62.223]) by sc9-mailhost2.vmware.com (Postfix) with ESMTP id 236CDB13DE; Mon, 28 Apr 2014 11:53:35 -0700 (PDT) Received: from zcs-prod-ext-mta-1.vmware.com (localhost.localdomain [127.0.0.1]) by zcs-prod-ext-mta-1.vmware.com (Postfix) with ESMTP id A62EB12002A; Mon, 28 Apr 2014 11:53:36 -0700 (PDT) Received: from [192.168.1.90] (zimbra-prod-ext-proxy-vip.vmware.com [10.113.63.87]) by zcs-prod-ext-mta-1.vmware.com (Postfix) with ESMTPSA; Mon, 28 Apr 2014 11:53:35 -0700 (PDT) Message-ID: <535EA3AD.6070209@vmware.com> Date: Mon, 28 Apr 2014 21:53:33 +0300 From: Heikki Linnakangas Organization: VMware User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Icedove/24.4.0 MIME-Version: 1.0 To: digoal@126.com, pgsql-bugs@postgresql.org Subject: Re: BUG #10155: BUG? Cann't remove new generated tuples after repeatable read transaction start. References: <20140428083725.2656.36967@wrigleys.postgresql.org> In-Reply-To: <20140428083725.2656.36967@wrigleys.postgresql.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -7.6 (-------) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org On 04/28/2014 11:37 AM, digoal@126.com wrote: > SESSION B : > but B cann't reclaim rows from table t. > why? > i think postgresql cann't reclaim tuples already exists before repeatable > read transaction start, why this case t's tuples after session a and cann't > reclaim. I think what you're arguing is that the system should be smarter and be able to reclaim the dead tuples. Because session A began before the table was even created, and there are no other backends that would need to see them either, they could indeed be safely vacuumed. The system just isn't smart enough to distinguish the case. The short answer is that such an optimization just doesn't exist in PostgreSQL. It's certainly not a bug. The long answer is that actually, even though the table was created after the transaction in session A began, session A *can* access the table. Schema changes don't follow the normal MVCC rules. If you do "SELECT * FROM t" in session A, it will work. However, the rows still won't be visible, to sessin A, because they were inserted after the snapshot was taken, so they could still be vacuumed if the system tracked the snapshots more carefully and was able to deduce that. But the fact that a new table was created is not relevant. - Heikki -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs