Re: ignore unique violation OR check row exists

Поиск
Список
Период
Сортировка
Искать
От
Misa Simic
Тема
Re: ignore unique violation OR check row exists
Дата
Msg-id
4121874819344867495@unknownmsgid
Список
Дерево обсуждения
Re: ignore unique violation OR check row exists Jasen Betts <jasen@xnet.co.nz>
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..

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

=E2=80=A2inert 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  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.

--=20
=E2=9A=82=E2=9A=83 100% natural


--=20
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 по дате отправления
От: Samuel Gendler
Дата:
От: Zdravko Balorda
Дата:
FAQ