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 46DFCCBB.10003@cox.net
Whole thread Raw
In response to Re: 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 04:20, Ow Mun Heng wrote:
> On Thu, 2007-09-06 at 04:07 -0500, Ron Johnson wrote:
>
>> On 09/06/07 01:13, Ow Mun Heng wrote:
>
>>> 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.
>
> "number" is just a fictitious column name. I use sane column names of
> course :-)

OK.

Maybe there's an English language "issue", or maybe I'm just
excessively picky, but using "number" in this context is confusing.

In any event, it didn't stop the Earth from spinning or the sun from
shining, so it can't be that bad of a problem...

>>> The update is taking a few hours and still hasn't ended.
>>>
>
>> Is it only *some* tuples that have the "extra space" problem?
>
> Actually, it's all of it

Then I agree with Alban:
  update table set number = trim(number);
or, if you need the leading spaces:
  update table set number = rtrim(number)

Then:
  update table set number = NULL where number = '';

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

iD8DBQFG38y7S9HxQb37XmcRAgC8AKDue6TRz4oLcmavV5u6dw0yOiQC4gCfVmgt
pCuDuyjOKh7LM/dfACkw3lc=
=KCw6
-----END PGP SIGNATURE-----

pgsql-general by date:

Previous
From: Ow Mun Heng
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