Re: How to check if a materialised view is being updated?

From: Philip Semanchuk <philip(at)americanefficient(dot)com>
To: Jayadevan M <maymala(dot)jayadevan(at)gmail(dot)com>
Cc: "Myklebust, Bjørn Magnar" <Bjorn(dot)Myklebust(at)skatteetaten(dot)no>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to check if a materialised view is being updated?
Date: 2021-01-19 13:40:03
Message-ID: 21D0846C-032D-4469-B8FF-39EC4368D6DE@americanefficient.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> On Jan 19, 2021, at 6:33 AM, Jayadevan M <maymala(dot)jayadevan(at)gmail(dot)com> wrote:
>
>
>
> So I’m looking for a way to identify if the refresh process is finished or if it’s still running - preferably without having to wait for timeout by querying a locked materialized view. But by e.g. using the system tables or otherwise.
>
>
>
> Can anybody suggest some pointers on how to do this?
>
>
> Maybe pg_stat_activity will have the refresh query?

Yes, pg_stat_activity has a query column that could be searched with the regular string matching tools, including regex if necessary. pg_stat_activity also has some other useful columns that, like query_start which can tell you how long the query has been running.

Cheers
Philip

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Kämpf 2021-01-19 14:30:41 Ist there a chance to provide postGIS 3.x combined with postgreSQL12 or 13 as a zypper repository released for SLES15 SP1 or SP2
Previous Message Myklebust 2021-01-19 12:54:36 Re: How to check if a materialised view is being updated?