Re: COPY data into a table with a SERIAL column?

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re: COPY data into a table with a SERIAL column?
Дата
Msg-id 5440291E.5060108@aklaver.com
обсуждение исходный текст
Ответ на Re: COPY data into a table with a SERIAL column?  (Steve Wampler <swampler@noao.edu>)
Список pgsql-general
On 10/16/2014 11:17 AM, Steve Wampler wrote:
> On 10/16/2014 10:44 AM, Rob Sargent wrote:
>> On 10/16/2014 11:38 AM, David G Johnston wrote:
>>> COPY is dumb but fast.  If you need logic you need to add it yourself.
>>> Either before the copy or copy into a temporary UNLOGGED table and write
>>> smart SQL to migrate from that to the live table.
>>>
>>> You can also put smarts into a trigger.
>
> Never thought about a trigger on a COPY before.  I'll look into that and
> see what the hit is.
>
> I was kinda hoping there was the equivalent of \N for indicating the use
> of a default value instead of a null value, but I accept that such a thing
> might be too expensive for COPY's goal in life.
>
> Maybe the best approach is to switch to a batched insert, which might be
> fast enough for my needs.

Might want to take a look at pg_bulkload:

http://pgbulkload.projects.pgfoundry.org/pg_bulkload.html

in particular its FILTER function:

http://pgbulkload.projects.pgfoundry.org/pg_bulkload.html#filter

>
> Thanks for the suggestions!
>


--
Adrian Klaver
adrian.klaver@aklaver.com


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

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: Any postgres API available to get errorcode for PQerrorMessage
Следующее
От: Josh Kupershmidt
Дата:
Сообщение: Re: Will pg_repack improve this query performance?