Need suggestion on how best to update 3 million rows

From: Ow Mun Heng <Ow(dot)Mun(dot)Heng(at)wdc(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Need suggestion on how best to update 3 million rows
Date: 2007-09-06 06:13:33
Message-ID: 1189059213.17792.57.camel@neuromancer.home.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I have a table in PG, Pulled from SQL Server using Perl DBI (w/o using
chopblanks) and have ended up with a column where the "space" is being
interpreted as a value.

eg:

"ABC " when it should be "ABC"

this is being defined as varchar(4)

I've already pull the relevent columns with

create foo as select unique_id, rtrim(number) from org_column

I've tried to do the update using

update org_column set number = foo.number where foo.unique_id =
org_column=unique_id.

The update is taking a few hours and still hasn't ended.

I've killed it already and rolled back the changes.

what's the easiest way to update these fields?

Thanks..

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ow Mun Heng 2007-09-06 06:47:58 Re: Need suggestion on how best to update 3 million rows
Previous Message Együd Csaba 2007-09-06 04:26:31 Getting sequence name for a non-serial column