Skip site navigation (1) Skip section navigation (2)

Re: how to update 400 000 register not at the same time?

From: Shane Ambler <pgsql(at)Sheeky(dot)Biz>
To: John Dizaro <jedsoftware(at)gmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: how to update 400 000 register not at the same time?
Date: 2008-12-02 16:30:34
Message-ID: 493562AA.2080203@Sheeky.Biz (view raw or flat)
Thread:
Lists: pgsql-sql
John Dizaro wrote:
> I Have um very big table with  primary key and all i nead.
> When i update same register from this table it comes sj=low.
> Can i Update all my  400 000 register not at the same time? By steps?
> 
> Thanks

Yes - provided you can come up with a definite way to separate your 
records into smaller groups.


Use a WHERE clause in your UPDATE -


UPDATE mytable SET col3=56 WHERE col1 IS BETWEEN 1 AND 10000
UPDATE mytable SET col3=56 WHERE col1 IS BETWEEN 10001 AND 20000
...
...


Of course you need to beware that it won't speed things up and you could
run into having other users looking at some old rows at the same time as
some updated rows.



-- 

Shane Ambler
pgSQL (at) Sheeky (dot) Biz

Get Sheeky @ http://Sheeky.Biz

In response to

pgsql-sql by date

Next:From: Milan OparnicaDate: 2008-12-02 23:10:59
Subject: Re: JOIN results of refcursor functions
Previous:From: Pavel StehuleDate: 2008-12-02 05:58:58
Subject: Re: JOIN results of refcursor functions

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group