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

From Greg Stark
Subject Re: Pre-set Hint bits/VACUUM FREEZE on data load..?
Date
Msg-id AANLkTikuy=j3mhjD2zR4hq694yX_wvQ6jkbEFTU6irwG@mail.gmail.com
Whole thread Raw
In response to Re: Pre-set Hint bits/VACUUM FREEZE on data load..?  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
Responses Re: Pre-set Hint bits/VACUUM FREEZE on data load..?
List pgsql-hackers
On Fri, Mar 25, 2011 at 8:09 AM, Heikki Linnakangas
<heikki.linnakangas@enterprisedb.com> wrote:
> The tricky part here is how to check if the table was created in the same
> transaction, within HeapTupleSatisfiesMVCC, with minimal overhead. If you do
> it naively, the check will be executed at every single tuple read in the
> system. It has to be really really fast.
>

You could have a single global boolean variable to indicate whether
any tables have been created in this transaction and inserted into
using this frozenxid hack in this transaction yet. That would be
branch predicted as false in any decent processor which shouldn't cost
anything. If it's true then you go off and check a small hash table.

The question is how often would the insert trigger with false
positives. That is, how often do people create tables, insert a small
number of records, then go off and do complex performance-sensitive
things in the same transaction. I suppose this does happen due to the
fairly common pattern of "I want temporary tables but they need to be
visible to this other transaction". For example for batch jobs where
you want to be able to display some sort of progress indicator.

-- 
greg


pgsql-hackers by date:

Previous
From: Cédric Villemain
Date:
Subject: Re: really lazy vacuums?
Next
From: Stephen Frost
Date:
Subject: Re: Pre-set Hint bits/VACUUM FREEZE on data load..?