Re: COPY and Volatile default expressions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Simon Riggs <simon(at)2ndQuadrant(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: COPY and Volatile default expressions
Date: 2013-04-15 15:49:42
Message-ID: 15279.1366040982@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Simon Riggs <simon(at)2ndQuadrant(dot)com> writes:
> COPY cannot be optimised correctly if we have before triggers or
> volatile default expressions.

> The multi-insert code detects those cases and falls back to the single
> row mechanism in those cases.

> There a common class of volatile functions that wouldn't cause
> problems: any volatile function that doesn't touch the table being
> loaded and still works correctly when called with alternately ordered
> data.

> I claim this is a common class, since sequence next_val functions and
> uuid generators meet that criteria and most common forms of auditing
> trigger, as well as any other form of data-reformatting trigger.

I don't believe that it's a good idea to consider nextval() to be
reorderable, so I'm not convinced by your argument here.

> What I'd like to do is to invent a new form of labelling that allows
> us to understand that COPY can still be optimised.

And I don't want to invent impossible-to-verify function attributes with
such a tiny use-case as this.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2013-04-15 15:53:13 Re: COPY and Volatile default expressions
Previous Message Simon Riggs 2013-04-15 15:49:10 Re: COPY and Volatile default expressions