Re: Pre-set Hint bits/VACUUM FREEZE on data load..? - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: Pre-set Hint bits/VACUUM FREEZE on data load..?
Date
Msg-id 4D8BB478.3040302@enterprisedb.com
Whole thread Raw
In response to Pre-set Hint bits/VACUUM FREEZE on data load..?  (Stephen Frost <sfrost@snowman.net>)
Responses Re: Pre-set Hint bits/VACUUM FREEZE on data load..?
Re: Pre-set Hint bits/VACUUM FREEZE on data load..?
Re: Pre-set Hint bits/VACUUM FREEZE on data load..?
List 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


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: [COMMITTERS] pgsql: Remove more SGML tabs.
Next
From: Robert Haas
Date:
Subject: Re: crash-safe visibility map, take four