Re: refresh materialized view concurrently

From: Kevin Grittner <kgrittn(at)ymail(dot)com>
To: Andres Freund <andres(at)2ndquadrant(dot)com>, Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: refresh materialized view concurrently
Date: 2013-06-27 14:25:12
Message-ID: 1372343112.77919.YahooMailNeo@web162905.mail.bf1.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andres Freund <andres(at)2ndquadrant(dot)com> wrote:

> We can play cute tricks akin to what CREATE INDEX CONCURRENTLY currently
> does, i.e. wait for all other relations that could have possibly seen
> the old relfilenode (they must have at least a share lock on the
> relation) before dropping the actual storage.
>
> The reason we cannot currently do that in most scenarios is that we
> cannot perform transactional/mvcc updates of non-exclusively locked
> objects due to the SnapshotNow problems of seeing multiple or no
> versions of a row during a single scan.

Not only would that be slower than the submitted patch in cases
where only a few rows differ, but it could be waiting to swap in
that new heap for an unbounded amount of time.  I think the current
patch will "play nicer" with incremental maintenance than what you
suggest here.

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2013-06-27 14:30:27 Re: Spin Lock sleep resolution
Previous Message Andres Freund 2013-06-27 14:24:17 Re: Move unused buffers to freelist