X-Original-To: pgsql-sql-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id B00DF9FA5FB for ; Mon, 12 Jun 2006 21:30:30 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 78100-03 for ; Mon, 12 Jun 2006 21:30:20 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 289329FA10A for ; Mon, 12 Jun 2006 21:30:21 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k5D0UFP9014242; Mon, 12 Jun 2006 20:30:15 -0400 (EDT) To: phillips@weatherbeeta.com.au cc: "'Aaron Bono'" , pgsql-sql@postgresql.org Subject: Re: COPY to table with array columns (Longish) In-reply-to: <003901c68e7a$4833dab0$9b0014ac@ITPhil> References: <003901c68e7a$4833dab0$9b0014ac@ITPhil> Comments: In-reply-to "Phillip Smith" message dated "Tue, 13 Jun 2006 09:45:26 +1000" Date: Mon, 12 Jun 2006 20:30:14 -0400 Message-ID: <14241.1150158614@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200606/125 X-Sequence-Number: 25361 "Phillip Smith" writes: > The whole sys file is variable length records like this - they range = > from 1 > to over 17,000 fields per record. 17000? I think you really need to rethink your schema. While you could theoretically drop 17000 elements into a PG array column, you wouldn't like the performance --- it'd be almost unsearchable for instance. I'd think about two tables, one with a single row for each SYS record from the original, and one with one row for each detail item (the invoice numbers in this case). With suitable indexes and a foreign key constraint, this will perform a lot better than an array-based translation. And no, in neither case will you be able to import that file without massaging it first. regards, tom lane