Re: optimizing import of large CSV file into partitioned table?

From: Filip Rembiałkowski <plk(dot)zuber(at)gmail(dot)com>
To: Thom Brown <thombrown(at)gmail(dot)com>
Cc: Rick Casey <caseyrick(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: optimizing import of large CSV file into partitioned table?
Date: 2010-03-28 23:37:20
Message-ID: 92869e661003281637w6f23b1b7gc279a40ef14a884a@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2010/3/28 Thom Brown <thombrown(at)gmail(dot)com>:

> The problem here is that you appear to require an index update, trigger
> firing and constraint check for every single row.  First thing I'd suggest
> is remove the indexes.  Apply that after your import, otherwise it'll have
> to update the index for every single entry.
+1

> And the trigger won't help
> either.  Import into a single table and split it out into further tables
> after if required.
note: partitioning could help if there were multiple physical volumes
/ spindles for data directory.
for maximizing performance, I would rather split the CSV input (with
awk/perl/whatever) before loading, to have one backend for each
partition loader.

> And finally the constraint should probably be applied
> after too, so cull any violating rows after importing.
+1

--
Filip Rembiałkowski
JID,mailto:filip(dot)rembialkowski(at)gmail(dot)com
http://filip.rembialkowski.net/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tim Landscheidt 2010-03-29 00:03:24 Re: Using readline for frequently used queries
Previous Message Stefan Keller 2010-03-28 22:57:20 hstore equality-index performance question