From: Tom Lane <tgl@sss.pgh.pa.us>
To: Wells Oliver <wells.oliver@gmail.com>
Cc: pgsql-admin <pgsql-admin@postgresql.org>
Subject: Re: Mat view sometimes taking 10x the time to refresh concurrently
Date: Thu, 27 May 2021 12:36:51 -0400
Message-ID: <1785391.1622133411@sss.pgh.pa.us> (raw)
In-Reply-To: <CAOC+FBVa10yEcxQ4heZeXA3n9Foa3O=GUWrY-ZgkrCsBrfC8tQ@mail.gmail.com>
References: <CAOC+FBVa10yEcxQ4heZeXA3n9Foa3O=GUWrY-ZgkrCsBrfC8tQ@mail.gmail.com>
Wells Oliver <wells.oliver@gmail.com> writes:
> Hey, we have a mat view that normally takes ~18m to re-materialize
> concurrently, which we do daily. Maybe once a week, it takes ~180m to
> refresh, and we're at a loss as to why.
> We are running backs during the same general time window, where we do
> backup the schema where this mat view is located, could this be an issue?
> We have not noticed any lock errors in the backup or log, though.
> Any tips on tracing this down would be appreciated.
My own mindset would be to wonder if a different/worse plan is being
chosen. You could investigate that perhaps by running an EXPLAIN
on the matview's query just before each refresh, to see if it changes.
Checking pg_locks for ungranted locks while the REFRESH is running
would be good to do too, although I'd think that a backup vs. a
concurrent refresh shouldn't have that sort of problem.
It seems possible also that you're just maxing out the machine's
I/O capacity between these two tasks.
regards, tom lane
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 using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: tgl@sss.pgh.pa.us, wells.oliver@gmail.com
Subject: Re: Mat view sometimes taking 10x the time to refresh concurrently
In-Reply-To: <1785391.1622133411@sss.pgh.pa.us>
* 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