Re: Pre-set Hint bits/VACUUM FREEZE on data load..?

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
Cc: Stephen Frost <sfrost(at)snowman(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Pre-set Hint bits/VACUUM FREEZE on data load..?
Date: 2011-03-25 19:06:59
Message-ID: AANLkTimOUQbS9UesBKUGFDgYEG38Yfx2z3h=GEdbmSVZ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Mar 25, 2011 at 4:00 AM, Heikki Linnakangas
<heikki(dot)linnakangas(at)enterprisedb(dot)com> wrote:
> On 25.03.2011 09:51, Heikki Linnakangas wrote:
>>
>> I don't think we should put the onus on the user to choose the right
>> data loading mode. If we can reliably detect the cases where it's safe
>> do these tricks, we can transparently apply them when possible. I would
>> be cool with tricks that apply only in narrow cases, as long as we don't
>> require the user to do anything.
>
> I believe the conditions for being able to set hint bits immediately at COPY
> are:
>
> 1. The table has been created or truncated in the same transaction
> 2. We are not in a subtransaction (or the table was created and truncated in
> the same subtransaction)
> 3. There are no open portals
> 4. Executing the COPY doesn't need to run any "unsafe" code that might
> access the same table. This includes triggers, check constraints and input
> functions. An expression is safe if it is immutable.

That's not enough... some other transaction could see the data before
the transaction commits.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Vaibhav Kaushal 2011-03-25 19:12:21 Re: When and how many times does ExecSetParamPlan executes?
Previous Message Tom Lane 2011-03-25 18:44:08 Re: Transactional DDL, but not Serializable