Re: Function Question - Inserting into a table with foreign constraints

From: David Johnston <polobo(at)yahoo(dot)com>
To: Brandon Phelps <bphelps(at)gls(dot)com>
Cc: "rod(at)iol(dot)ie" <rod(at)iol(dot)ie>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Function Question - Inserting into a table with foreign constraints
Date: 2011-11-05 15:23:26
Message-ID: FFE71119-4063-4D2B-9440-61FAA82F1898@yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Nov 5, 2011, at 10:46, Brandon Phelps <bphelps(at)gls(dot)com> wrote:

> On 11/5/2011 10:35 AM, Raymond O'Donnell wrote:
>> On 05/11/2011 04:34, Brandon Phelps wrote
>
> With the method you outlined will I notice any huge performance impacts? The application would be parsing incoming data from another 3rd party application and could, at times, be executing the function in very fast succession, although never twice at the exact same moment (single threaded application, pending events will just block until they're up).
>
> Thanks again!
>

You would probably be much better off importing the third-party data into a staging table, performing all of your "key" creation, and then inserting the data into your final tables.

While triggers would work you end up with a lot of pointless effort when in most cases keys are likely to exist.

David J.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Raymond O'Donnell 2011-11-05 15:24:36 Re: Function Question - Inserting into a table with foreign constraints
Previous Message Brandon Phelps 2011-11-05 14:46:22 Re: Function Question - Inserting into a table with foreign constraints