Re: pg_wal fills up on big update query

From: Rob Sargent <robjsargent(at)gmail(dot)com>
To: "Daniel Fink (PDF)" <daniel(dot)fink(at)pdf(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: pg_wal fills up on big update query
Date: 2019-08-07 14:22:06
Message-ID: 05D718F2-9A80-4A9B-A84A-B9C332943AC3@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> On Aug 7, 2019, at 7:34 AM, Daniel Fink (PDF) <daniel(dot)fink(at)pdf(dot)com> wrote:
>
> Hi all,
>
> I have a migration where I
> · Add a new nullable column to a table
> · update almost every row in this big table (8 million rows) from another table where I set this new column
>
> I have also a replication setup running.
> The database has a size of around 20GB.
> While the migration is running, it more than doubles is size and fills up all space.
> Then the migration fails and is rolled back.
>
> What is the best way of keeping this from happening?
> My current idea is to lock both tables completely from access (the queried and the updated one) so that postgresql does not have to ensure isolation for concurrent queries by keeping a copy of each row.
> Is my thinking here correct?
>
> Thanks in advance and Best Regards,
>
Do the update in small chunks

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Luca Ferrari 2019-08-07 14:34:55 Re: pg_wal fills up on big update query
Previous Message Adrian Klaver 2019-08-07 14:19:49 Re: Why must AUTOCOMMIT be ON to do txn control in plpgsql procedure?