Re: Need to update all my 60 million rows at once without transactional integrity - Mailing list pgsql-general

From Merlin Moncure
Subject Re: Need to update all my 60 million rows at once without transactional integrity
Date
Msg-id b42b73150804230827w3a2fb591p9c2839f255903f54@mail.gmail.com
Whole thread Raw
In response to Re: Need to update all my 60 million rows at once without transactional integrity  (Alvaro Herrera <alvherre@commandprompt.com>)
List pgsql-general
On Wed, Apr 23, 2008 at 9:04 AM, Alvaro Herrera
<alvherre@commandprompt.com> wrote:
> christian_behrens@gmx.net wrote:
>
>
> > How can I make a Update of a column in a very large table for all rows
>  > without using the double amount of disc space and without any need for
>  > atomic operation?
>  >
>  > I have a very large table with about 60 million rows. I sometimes need
>  > to do a simple update to ALL rows that resets a status-flag to zero.
>
>  Perhaps you should rethink your data model.

for example:
*) change status-flag to a timestamp
*) make a new table (status_reset or something) with one column, one row...and
*) make a view (perhaps swapping names with your original table) that
joins the two tables and preserves the 1/0 status flag column
appearance so you don't have to change the app.

Consider the fundamental tenet: 'If PostgreSQL can't do it well, you
are probably doing it the wrong way' :-)

merlin

pgsql-general by date:

Previous
From: Greg Smith
Date:
Subject: Re: Debian etch, backport postgresql 8.3 experiences?
Next
From: Tom Lane
Date:
Subject: Re: Backup setup