From: | Rob Sargent <robjsargent(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Re: Improve COPY performance into table with indexes. |
Date: | 2020-04-03 16:08:04 |
Message-ID: | 87083802-1fb6-52c9-b651-fdfdbe1232a2@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 4/3/20 9:52 AM, Adrian Klaver wrote:
> On 4/2/20 9:42 PM, James Brauman wrote:
>> I am using the COPY command to insert 10 million rows from a CSV file
>> into a database table and I am finding the performance is
>> unacceptable. When the COPY command is executed the disk I/O is
>> extremely high which leads to degraded query performance for other
>> queries being executed on the database.
>>
>> I have tried removing the indexes from the database table and this
>> dramatically improved performance (both reducing the execution time
>> and reducing disk I/O).
>
I've had excellent results dealing similar data quantity with the
earlier suggestion of writing to a staging table. Simply splitting the
insert statements to cover 1/16[1] of the data turned untenable into
real-time.
[1] I split on an id column which is of UUID type. Any arbitrary
splitting that reduces the footprint sufficiently will do.
From | Date | Subject | |
---|---|---|---|
Next Message | Moses Mafusire | 2020-04-03 16:26:31 | Re: Cstore_fdw issue. |
Previous Message | Adrian Klaver | 2020-04-03 15:52:21 | Re: Improve COPY performance into table with indexes. |