Re: ignore unique violation OR check row exists

Поиск
Список
Период
Сортировка
От Misa Simic
Тема Re: ignore unique violation OR check row exists
Дата
Msg-id 4121874819344867495@iso-8859-1msgid
обсуждение исходный текст
Ответ на ignore unique violation OR check row exists  (rverghese <riyav@hotmail.com>)
Список pgsql-sql
Well, idea is to make process faster as possible... And usualy staging
table does not have any constrains so can't violates...

When we want to import banch of data... Process when we taking row by
row from source, validate it, if valid insert to some table could be
very slow...

Much faster is when we work with sets..

•import all records to some table without constrains (staging table).
And best would be if we can use COPY command instead of insert...

•inert into liveTable select all valid records from stagingTable

Of course it is just in case when we want to import what is ok... In
case all or nothing - import direct to liveTable works fine...

Sent from my Windows Phone
From: Jasen Betts
Sent: 04/01/2012 10:02
To: pgsql-sql@postgresql.org
Subject: Re: [SQL] ignore unique violation OR check row exists
On 2012-01-03, Misa Simic <misa.simic@gmail.com> wrote:
> If exists is better, though insert line by line and check if exists may
> be very slow...
>
> The best would be if you can use copy command from csv to staging table
> (without constraints) and then
>
> Insert to live from stage where stage constraint column not exist in
> live...
>

Its a good idea to check that the staging table doesn't
conflict with itself, before tryign to insert it.

--
⚂⚃ 100% natural


--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql


В списке pgsql-sql по дате отправления:

Предыдущее
От: rverghese
Дата:
Сообщение: Re: ignore unique violation OR check row exists
Следующее
От: Feike Steenbergen
Дата:
Сообщение: Re: Current transaction is aborted, commands ignored until end of transaction block