From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "Chad Thompson" <chad(at)weblinkservices(dot)com> |
Cc: | "pgsql-novice" <pgsql-novice(at)postgresql(dot)org> |
Subject: | Re: Copy Questions |
Date: | 2003-01-25 00:59:38 |
Message-ID: | 28042.1043456378@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
"Chad Thompson" <chad(at)weblinkservices(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Desmond Coughlan | 2003-01-25 03:15:43 | Altering Column Date Types |
Previous Message | Devinder K Rajput | 2003-01-24 21:59:39 | Re: Can't read input file |