Re: REFRESH MATERIALIZED VIEW locklevel

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Kevin Grittner <kgrittn(at)ymail(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: REFRESH MATERIALIZED VIEW locklevel
Date: 2013-03-07 18:23:55
Message-ID: 20130307182355.GA4029@awork2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-advocacy pgsql-hackers

On 2013-03-07 09:55:39 -0800, Kevin Grittner wrote:
> Andres Freund <andres(at)2ndquadrant(dot)com> wrote:
>
> > if I understand things correctly REFRESH MATERIALIZED VIEW locks
> > the materialized view with an AcessExclusiveLock even if the view
> > already contains data.
>
> Yeah.  At the time I had to make a decision on that, REINDEX
> CONCURRENTLY did not seem reliable with a weaker lock, and REFRESH
> MATERIALIZED VIEW has to rebuild indexes (among other things).  If
> we have all the issues sorted out with REINDEX CONCURRENTLY then
> the same techniques will probably apply to RMV without too much
> difficulty.  It's a bit late to think about that for 9.3, though.

I don't think that REFRESH MATERIALIZED VIEW has to deal with the same
problems that REINDEX CONCURRENTLY has - after all, there won't be any
DML coming in while its running. That should get rid of the REINDEX
CONCURRENTLY problems.
There doesn't seem to be any need to use the far more expensive REINDEX
CONCURRENLTY style computation of indexes which has to scan the heap
multiple times et al. They just should be built ontop of new matview
relation which is essentially read only.

> > I am pretty sure that will - understandably - confuse users, so I
> > vote for at least including a note about that in the docs.
>
> Will see about working that in.

Cool.

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Browse pgsql-advocacy by date

  From Date Subject
Next Message anarazel@anarazel.de 2013-03-07 19:00:08 Re: REFRESH MATERIALIZED VIEW locklevel
Previous Message Kevin Grittner 2013-03-07 17:55:39 Re: REFRESH MATERIALIZED VIEW locklevel

Browse pgsql-hackers by date

  From Date Subject
Next Message Ray Stell 2013-03-07 18:42:36 Re: Trust intermediate CA for client certificates
Previous Message Kevin Grittner 2013-03-07 17:55:39 Re: REFRESH MATERIALIZED VIEW locklevel