[ic] Trying to import 50,000 items

Jon Jensen interchange-users@icdevgroup.org
Tue Aug 6 11:49:00 2002


On Tue, 6 Aug 2002, Nicholas Cook wrote:

> I am trying to import a catalog of roughly 50,000 items and I am finding 
> the import from the admin ui too slow (timing out on webserver). 
> Database is PostgreSQL 7.1.3 and Interchange 4.8.3.  Is there a command 
> line utility to allow this from a tab delineated file.  Also, curiosity 
> question.  For those other people that have done the same, roughly how 
> long did it take for your import to finish.

By far the fastest way is to use PostgreSQL's native COPY command. From 
psql type "\h copy" but then make sure to do \copy instead, like this:

\copy mytable from myfile.txt

The only catch is you need to remove the first line of the file with the 
column names.

If you ever decide to do imports via SQL queries in PostgreSQL, make sure 
to do the whole thing inside a single transaction, and it will be very 
fast:

BEGIN;
INSERT INTO table VALUES ... ;
COMMIT;

Jon