Re: Updating a very large table

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ron Mayer <rm_pg(at)cheapcomplexdevices(dot)com>
Cc: Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>, Chris Browne <cbbrowne(at)acm(dot)org>, pgsql-admin(at)postgresql(dot)org
Subject: Re: Updating a very large table
Date: 2009-04-25 13:59:39
Message-ID: 5486.1240667979@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Ron Mayer <rm_pg(at)cheapcomplexdevices(dot)com> writes:
> Would doing something with ctid be even better?
> Or does it have some risks I'm missing. I'm thinking
> something like:

> update table set new_column=[whatever] where ctid<'(10000,1)';
> vacuum;
> update table set new_column=[whatever] where ctid>'(10000,1)' and ctid<'(20000,1');
> vacuum;
> ...
> update table set new_column=[whatever] where ctid>'(180000,1)';
> vacuum;

You are forgetting the fact that an UPDATE in itself changes a row's
ctid.

regards, tom lane

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Félix Sánchez Rodríguez 2009-04-26 14:47:24 Re: Deleting "parent" record
Previous Message Ron Mayer 2009-04-25 05:26:29 Re: Updating a very large table