Re: Insert performance for large transaction with multiple COPY FROM

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
Cc: Claudio Freire <klaussfreire(at)gmail(dot)com>, Horst Dehmer <horst(dot)dehmer(at)gmail(dot)com>, postgres performance list <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Insert performance for large transaction with multiple COPY FROM
Date: 2013-01-12 22:26:51
Message-ID: 24687.1358029611@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Jeff Janes <jeff(dot)janes(at)gmail(dot)com> writes:
> Will PG allow you to add a FK constraint where there is no usable
> index on the referenced side?

It will not, because the referenced side must have a unique constraint,
ie an index.

The standard performance gotcha here is not having an index on the
referencing side. But that only hurts when doing UPDATEs/DELETEs of
referenced-side keys, which as far as I gathered was not the OP's
scenario.

regards, tom lane

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Horst Dehmer 2013-01-12 22:41:53 Re: Insert performance for large transaction with multiple COPY FROM
Previous Message Claudio Freire 2013-01-12 22:18:05 Re: Insert performance for large transaction with multiple COPY FROM