Re: REFRESH MATERIALIZED VIEW locklevel

From: Kevin Grittner <kgrittn(at)ymail(dot)com>
To: "anarazel(at)anarazel(dot)de" <andres(at)anarazel(dot)de>, Andres Freund <andres(at)2ndquadrant(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: REFRESH MATERIALIZED VIEW locklevel
Date: 2013-03-07 19:50:11
Message-ID: 1362685811.64440.YahooMailNeo@web162903.mail.bf1.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-advocacy pgsql-hackers

"anarazel(at)anarazel(dot)de" <andres(at)anarazel(dot)de> wrote:

> In the ride home I realized that unless - not that unlikely - you
> thought about something I didtn't  REFRESH will behave similar to
> TRUNCATE for repeatable read+ transactions that only access it
> after REFRESH finished. That is, they will appear empty.

In an early version of the patch someone found that in testing and
pointed it out.

> It would be possible to get different behaviour by immediately
> freezing all tuples

Which is what I did.

> but that would also result in violations of visibility by showing
> tuples that are not yet visible.

Which is the case, and should be documented.  (I had not remembered
to do so yet; I'll tuck away your email as a reminder.)  Since the
MV is already not guaranteed to be in sync with other data, that
didn't seem like a fatal flaw.  It is, however, the one case where
the MV could appear to be *ahead* of the supporting data rather
than *behind* it.  In a way this is similar to how READ COMMITTED
transactions can see data from more than one snapshot on write
conflicts, so I see it as a bigger issue for more strict isolation
levels -- but those are unlikely to be all that useful with MVs in
this release anyway.  This is something that I think deserves some
work in a subsequent release.

--
Kevin Grittner
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-advocacy by date

  From Date Subject
Next Message Andres Freund 2013-03-07 23:17:58 Re: REFRESH MATERIALIZED VIEW locklevel
Previous Message anarazel@anarazel.de 2013-03-07 19:00:08 Re: REFRESH MATERIALIZED VIEW locklevel

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2013-03-07 20:04:02 Re: Duplicate JSON Object Keys
Previous Message David E. Wheeler 2013-03-07 19:48:45 Duplicate JSON Object Keys