Re: COPY: row is too big

From: vod vos <vodvos(at)zoho(dot)com>
To: "Adrian Klaver" <adrian(dot)klaver(at)aklaver(dot)com>
Cc: "Steve Crawford" <scrawford(at)pinpointresearch(dot)com>, "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>, "John McKown" <john(dot)archie(dot)mckown(at)gmail(dot)com>, "Rob Sargent" <robjsargent(at)gmail(dot)com>, "pgsql-general" <pgsql-general(at)postgresql(dot)org>
Subject: Re: COPY: row is too big
Date: 2017-01-05 12:44:06
Message-ID: 1596ea8639b.f2869ae91118.1165294942643742165@zoho.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I finally figured it out as follows:

1. modified the corresponding data type of the columns to the csv file

2. if null values existed, defined the data type to varchar. The null values cause problem too.

so 1100 culumns work well now.

This problem wasted me three days. I have lots of csv data to COPY.

---- On 星期三, 04 一月 2017 08:39:42 -0800 Adrian Klaver &lt;adrian(dot)klaver(at)aklaver(dot)com&gt; wrote ----

On 01/04/2017 08:32 AM, Steve Crawford wrote:

&gt; ...

&gt;

&gt; Numeric is expensive type - try to use float instead, maybe double.

&gt;

&gt;

&gt; If I am following the OP correctly the table itself has all the

&gt; columns declared as varchar. The data in the CSV file is a mix of

&gt; text, date and numeric, presumably cast to text on entry into the table.

&gt;

&gt;

&gt; But a CSV *is* purely text - no casting to text is needed. Conversion is

&gt; only needed when the strings in the CSV are text representations of

&gt; *non*-text data.

Yeah, muddled thinking.

&gt;

&gt; I'm guessing that the OP is using all text fields to deal with possibly

&gt; flawed input data and then validating and migrating the data in

&gt; subsequent steps. In that case, an ETL solution may be a better

&gt; approach. Many options, both open- closed- and hybrid-source exist.

&gt;

&gt; Cheers,

&gt; Steve

--

Adrian Klaver

adrian(dot)klaver(at)aklaver(dot)com

--

Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)

To make changes to your subscription:

http://www.postgresql.org/mailpref/pgsql-general

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message marcin kowalski 2017-01-05 12:47:40 Re: vacuum of empty table slows down as database table count grows
Previous Message marcin kowalski 2017-01-05 07:18:17 Re: vacuum of empty table slows down as database table count grows