Re: Copy Questions

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Copy Questions
Дата
Msg-id 28042.1043456378@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Copy Questions  ("Chad Thompson" <chad@weblinkservices.com>)
Список pgsql-novice
"Chad Thompson" <chad@weblinkservices.com> writes:
> I have csv files that are sent to me on a regular basis.  ~ 50k records a p=
> iece.
> I have been simply using insert to date, but wonder if copy would give me b=
> etter performance.

Certainly.

> My questions are:
> 1) If I use copy, the docs suggest that I copy to a temp table then insert =
> into mytable from temptable, in order for the sequence to fire.
> Does the copy of 7.3 allow sequences to fire during copy?

Yes, in 7.3 you can specify that the data coming from the file fills
only selected columns of the table; the other columns are then filled
with defaults (such as sequence values).

The temp-table idea is mainly useful if you want to massage the data
before you actually insert it --- for instance, do arithmetic, trim
trailing blanks, or whatever.  You can do all that stuff in the
INSERT/SELECT command.

> 2) The docs also suggest that I drop my indexes and reindex.

This would only make sense when the new data represents a large fraction
of the total table size.

            regards, tom lane

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

Предыдущее
От: "Devinder K Rajput"
Дата:
Сообщение: Re: Can't read input file
Следующее
От: Desmond Coughlan
Дата:
Сообщение: Altering Column Date Types