Received: from joeconway.com (unknown [63.210.180.150]) by postgresql.org (Postfix) with ESMTP id C951C474E71 for ; Sat, 13 Apr 2002 14:38:26 -0400 (EDT) Received: from [192.168.5.2] (account jconway HELO joeconway.com) by joeconway.com (CommuniGate Pro SMTP 3.5.6) with ESMTP-TLS id 328832; Sat, 13 Apr 2002 10:30:51 -0800 Message-ID: <3CB87B30.1010203@joeconway.com> Date: Sat, 13 Apr 2002 11:38:40 -0700 From: Joe Conway User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.9) Gecko/20020311 X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Nigel J. Andrews" Cc: pgsql-general Subject: Re: COPY performance References: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Archive-Number: 200204/532 X-Sequence-Number: 23247 Nigel J. Andrews wrote: > > I'm trying to COPY in a table of 1 million rows. The table is created by: > > create table chat_post_new ( > session_id INT NOT NULL references chat_session (session_id), > poster_name VARCHAR(32) NOT NULL, > time TIMESTAMP NOT NULL, > post_number INT NOT NULL, > FTS txtidx > ); > > The old definition had the integer columns as int2s and the FTS column wasn't > there. Because I wanted to reorder the rows, add them in a more natural order > (by time), I created the data file read in by the copy command using > > SELECT session_id || '\t' || poster_name || '\t' || time || '\t' || post_number > FROM chat_post > ORDER BY time > > After removing the first and last couple of lines, so that only the data is in > the file, renaming the original table and creating the new version I tried > running: > > COPY chat_post FROM 'file-path' > I'm not sure if this is your problem, but I believe you need the same number of columns in your file as your table. So if you want FTS to be null, append \N to the output, e.g. SELECT session_id || '\t' || poster_name || '\t' || time || '\t' || post_number || '\t\N' FROM chat_post ORDER BY time Also, you should probably leave the foreign key reference off the table and add it after you load the data. Hope this helps, Joe