Re: Need suggestion on how best to update 3 million rows - Mailing list pgsql-general

From Ron Johnson
Subject Re: Need suggestion on how best to update 3 million rows
Date
Msg-id 46DFC340.504@cox.net
Whole thread Raw
In response to Need suggestion on how best to update 3 million rows  (Ow Mun Heng <Ow.Mun.Heng@wdc.com>)
Responses Re: Need suggestion on how best to update 3 million rows  (Ow Mun Heng <Ow.Mun.Heng@wdc.com>)
List pgsql-general
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 09/06/07 01:13, Ow Mun Heng wrote:
> 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.

Number?  Where does "number" come from?  Unless you've got weird
field names, that doesn't sound like a very good name for a
VARCHAR(4) column.

> 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?

Is it only *some* tuples that have the "extra space" problem?

- --
Ron Johnson, Jr.
Jefferson LA  USA

Give a man a fish, and he eats for a day.
Hit him with a fish, and he goes away for good!

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFG38NAS9HxQb37XmcRAlZhAKCMtXSMzvbZ04M3YAdlAhjN4p7rSQCfZTDp
Goyd+/FIFdwoc7IA87Mr3xM=
=hJfr
-----END PGP SIGNATURE-----

pgsql-general by date:

Previous
From: Alban Hertroys
Date:
Subject: Re: Need suggestion on how best to update 3 million rows
Next
From: Ow Mun Heng
Date:
Subject: Re: Need suggestion on how best to update 3 million rows