From: | Andy Colson <andy(at)squeakycode(dot)net> |
---|---|
To: | Lee Hachadoorian <Lee(dot)Hachadoorian+L(at)gmail(dot)com> |
Cc: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Multiple COPY statements |
Date: | 2012-05-10 19:16:53 |
Message-ID: | 4FAC1425.2090908@squeakycode.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 5/10/2012 2:00 PM, Lee Hachadoorian wrote:
> On Thu, May 10, 2012 at 2:42 PM, Andy Colson<andy(at)squeakycode(dot)net> wrote:
>> On 5/10/2012 1:10 PM, Lee Hachadoorian wrote:
>>>
>>> 2) Is there a performance hit to doing a COPY to more than one table
>>> in the same transaction?
>>
>>
>> No, I don't think so. I assume you are the only user hitting the
>> import_table, so holding one big transaction wont hurt anything.
>
> Actually what I mean is that there are multiple import tables,
> import_table1 ... import_table100. But it is true that I would be the
> only user hitting the import tables.
>
>>> Any other advice will be appreciated.
>>
>>
>> To really speed it up, you'd need to run multiple concurrent connections
>> each doing COPY's. Maybe up to the number of cores you have. (of course
>> you dont want each connection to fire off truncates, but concurrent should
>> trump "skip wall" in terms of speed).
>>
>> If import_table is just a temp holding stot you can look into temp and/or
>> unlogged tables.
>
> Yes, it is a staging table, data needs to be manipulated before
> shunting to its desired destination. I think unlogged tables will be
> helpful, and if I understand correctly then I wouldn't need to use the
> BEGIN; TRUNCATE; COPY...; END; trick. And would unlogged + concurrent
> connections work together?
>
> --Lee
>
Oh yes. concurrent + unlogged would be the best of all worlds.
-Andy
From | Date | Subject | |
---|---|---|---|
Next Message | Evan Carroll | 2012-05-10 20:13:28 | Re: Custom Domain; migration from 8.4 to 9.1 and COLLATE |
Previous Message | Prashant Bharucha | 2012-05-10 19:12:19 | Sequence scan if "OR Condition" in where statement |