From: Rob Sargent <robjsargent@gmail.com>
To: Daniel Fink (PDF) <daniel.fink@pdf.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: pg_wal fills up on big update query
Date: Wed, 7 Aug 2019 08:22:06 -0600
Message-ID: <05D718F2-9A80-4A9B-A84A-B9C332943AC3@gmail.com> (raw)
In-Reply-To: <4b0d1ee711c4079c0544216bb2bdff4b@mail.gmail.com>
References: <4b0d1ee711c4079c0544216bb2bdff4b@mail.gmail.com>
> On Aug 7, 2019, at 7:34 AM, Daniel Fink (PDF) <daniel.fink@pdf.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=
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: robjsargent@gmail.com, daniel.fink@pdf.com
Subject: Re: pg_wal fills up on big update query
In-Reply-To: <05D718F2-9A80-4A9B-A84A-B9C332943AC3@gmail.com>
References: <4b0d1ee711c4079c0544216bb2bdff4b@mail.gmail.com> <05D718F2-9A80-4A9B-A84A-B9C332943AC3@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox