Re: COPY to table with array columns (Longish) - Mailing list pgsql-sql

From Tom Lane
Subject Re: COPY to table with array columns (Longish)
Date
Msg-id 14241.1150158614@sss.pgh.pa.us
Whole thread Raw
In response to Re: COPY to table with array columns (Longish)  ("Phillip Smith" <phillips@weatherbeeta.com.au>)
Responses Re: COPY to table with array columns (Longish)
List pgsql-sql
"Phillip Smith" <phillips@weatherbeeta.com.au> 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


pgsql-sql by date:

Previous
From: "Phillip Smith"
Date:
Subject: Re: COPY to table with array columns (Longish)
Next
From: "Aaron Bono"
Date:
Subject: Re: COPY to table with array columns (Longish)