pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <hlinnakangas@vmware.com>
To: digoal@126.com
To: pgsql-bugs@postgresql.org
Subject: Re: BUG #10155: BUG? Cann't remove new generated tuples after repeatable read transaction start.
Date: Mon, 28 Apr 2014 21:53:33 +0300
Message-ID: <535EA3AD.6070209@vmware.com> (raw)
In-Reply-To: <20140428083725.2656.36967@wrigleys.postgresql.org>
References: <20140428083725.2656.36967@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

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



view thread (4+ messages)  latest in thread

Message-ID: <535EA3AD.6070209@vmware.com>
Permalink:  ../535EA3AD.6070209@vmware.com/
Also on:    postgresql.org/message-id/535EA3AD.6070209@vmware.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: hlinnakangas@vmware.com, digoal@126.com
  Subject: Re: BUG #10155: BUG? Cann't remove new generated tuples after repeatable read transaction start.
  In-Reply-To: <535EA3AD.6070209@vmware.com>
  References: <20140428083725.2656.36967@wrigleys.postgresql.org> <535EA3AD.6070209@vmware.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox