Re: Need suggestion on how best to update 3 million rows

From: hubert depesz lubaczewski <depesz(at)depesz(dot)com>
To: Alban Hertroys <alban(at)magproductions(dot)nl>
Cc: Ow Mun Heng <Ow(dot)Mun(dot)Heng(at)wdc(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Need suggestion on how best to update 3 million rows
Date: 2007-09-06 11:15:31
Message-ID: 20070906111531.GA7520@depesz.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Sep 06, 2007 at 11:08:02AM +0200, Alban Hertroys wrote:
> create index tmp_idx on table(number) where number != trim(number);
> analyze table;
> update table set number = trim(number) where number != trim(number);

dont use !=. use <>. != does something different, and in fact it is
not a real operator - it's just 2 operators bundled together.

depesz

--
quicksil1er: "postgres is excellent, but like any DB it requires a
highly paid DBA. here's my CV!" :)
http://www.depesz.com/ - blog dla ciebie (i moje CV)

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Nis Jørgensen 2007-09-06 11:31:25 Re: SQL query with IFs (?) to "Eliminate" NULL Values
Previous Message Stefan Schwarzer 2007-09-06 11:06:14 Rankinf of Results?