From: | Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com> |
---|---|
To: | Stephen Frost <sfrost(at)snowman(dot)net> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Pre-set Hint bits/VACUUM FREEZE on data load..? |
Date: | 2011-03-24 21:15:36 |
Message-ID: | 4D8BB478.3040302@enterprisedb.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 24.03.2011 23:08, Stephen Frost wrote:
> In a discussion which came up at PgEast, I questioned if it'd be
> possible to set the 'all visible' hint bit and give the tuples the
> frozen XID when loading data into a table which was created in the
> same transaction.
>
> The idea being that no other transactions could see the table (in any
> important way anyway.. couldn't SELECT from it, for example) since it
> was created in the same transaction that the data was loaded. This
> would avoid having to rewrite the table to set the hint bits and to
> set the tuples as frozen after the data load.
The problem is that you still need to track which queries within the
transaction can see the tuples. For example:
BEGIN;
CREATE TABLE foo ...
INSERT INTO foo VALUES (1);
DECLARE foocur CURSOR FOR SELECT * FROM foo;
FETCH foocur;
INSERT INTO foo VALUES (2);
FETCH foocur;
The cursor was opened before the 2nd tuple was inserted, so it should
not be returned by the cursor.
There's also corner cases like triggers that query the same table, and
self-joins.
--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2011-03-24 21:18:51 | Re: crash-safe visibility map, take four |
Previous Message | Robert Haas | 2011-03-24 21:12:58 | Re: [COMMITTERS] pgsql: Remove more SGML tabs. |